helper-aggregate
v0.1.2
Published
{{aggregate}} handlebars helper. Inlines content from multiple files optionally using wildcard (globbing/minimatch) patterns, extracts YAML front matter to pass to context for each file. Accepts compare function as 3rd parameter for sorting inlined files.
Downloads
76
Readme
{{aggregate}}
{{aggregate}} handlebars helper. Inlines content from multiple files optionally using wildcard (globbing/minimatch) patterns, extracts YAML front matter to pass to context for each file. Accepts compare function as 3rd parameter for sorting inlined files.
Quickstart
In the root of your project, run the following in the command line:
npm i helper-aggregate --save-dev
Usage
{{aggregate 'path/to/*.hbs'}}
Usage in Assemble
In your Gruntfile, simply add helper-aggregate
to the helpers
property in the Assemble task or target options:
grunt.initConfig({
assemble: {
options: {
helpers: ['helper-aggregate']
}
...
}
});
With that completed, you may now use the {{aggregate}}
helper in your Assemble project.
Options
sep
Type: String
Default value: \n
The separator to append after each inlined file.
Setting options
hash options
Set options as hash arguments.
---
chapter: 1
---
{{aggregate 'path/to/*.hbs' sep="\n\n\n"}}
"assemble" task options
Pass Assemble options into the helper.
In your project's Gruntfile, options for the {{aggregate}}
helper can be defined in the Assemble task options:
grunt.initConfig({
assemble: {
options: {
aggregate: {
sep: '\n',
compare_fn: 5
}
}
...
}
});
Note that the options are defined in the custom property, aggregate
, not on the options
object itself.
Author
Jon Schlinkert
License and Copyright
Licensed under the MIT License Copyright (c) Jon Schlinkert, contributors.