Broccoli plugin that renders handlebars templates.
Plugin supports caching:
- It caches template files and re-render only changed files.
- It caches partials and re-render all templates, when some partial is changed.
npm install broccoli-render-handlebars
var renderHandlebars = require('broccoli-render-handlebars')
var tree = renderHandlebars('inputDir', {
// Paths or glob patterns
files: ['templates/**/*.hbs'],
partials: ['partials/**/*.hbs']
})
Broccoli input tree
Object with options
Type: array.<string>
Default: ['**/*.hbs', '**/*.handlebars']
List of files or glob patterns of templates to render.
Type: array.<string>
List of files or glob patterns of partial templates.
Type: function(string) -> string
Default: Path with removed .hbs
or .handlebars
extension.
Function that takes path of partial and returns name.
Type: object
Handlebars helpers.
Type: object|function(string) -> object
Handlebars render context or function that takes path of template and returns context.
Type: function(string) -> string
Default: Path with .hbs
or .handlebars
extension changed to .html
.
Function that takes path of template and returns name of rendered file.
Type: object
Handlebars instance with already registered helpers and partials.
Public domain, see the LICENCE.md
file.