Assemble automatically registers any partial or array of partials supplied to options.partials
, at the task or target level.
assemble {
docs: {
options: {
partials: ['src/templates/partials/**/*.md' ]
},
files: {
'docs/': ['src/templates/pages/*.md' ]
}
}
}
Although this is not an "officially supported" feature, you can also pass partials in through the options.helpers
object:
Handlebars.registerPartial('title', '<strong>{{title}}</strong>' );
If you wish to register partials this way, follow the same practices as registering helpers.
Any partials registered at the task level are are also available at the target level.
Important! It is standard in Grunt.js for target-level options to overwrite task-level options. However, assemble merges the list of partials defined at the task-level with the partials defined for each target.
You can establish context inside the partials:
{{> module module.panel -primary }}
{{> module module.panel -info }}
{{> module module.panel -success }}
{{> module module.panel -warning }}
{{> module module.panel -danger }}
{{> module module.panel -query }}
Wrap partials in block expressions and either set the context on the partial:
{{#module }}
{{> module panel -inverse }}
{{> module panel -success }}
{{> module panel -info }}
{{/module }}
Or on the section tags:
{{#module.panel -base }}
{{> module }}
{{/module.panel -base }}
See the template for this page →
Find an error? Let us know →