Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
101 lines (73 sloc) 2.01 KB
title: options.partials
shortname: partials
area: docs
section: configuration
- options
- templates
- templates
- partial
- partials
- includes
* Globbing
* task/target merging
* How data works: YFM, JSON, YAML
* How context works (title, this.title, component.title, etc)
* Build docs pages and components at once
## Registering Partials
Assemble automatically registers any partial or array of partials supplied to `options.partials`, at the task or target level.
``` javascript
assemble {
docs: {
options: {
partials: ['src/templates/partials/**/*.md']
files: {
'docs/': ['src/templates/pages/*.md']
### Tip
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](Helpers).
### Task-target behavior
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.
## Usage examples
### Ways to apply context to partials
#### "Inline"
You can establish context inside the partials:
``` handlebars
\{{> module module.panel-primary}}
\{{> module module.panel-info}}
\{{> module module.panel-success}}
\{{> module module.panel-warning}}
\{{> module module.panel-danger}}
\{{> module module.panel-query}}
#### Block expressions
Wrap partials in block expressions and either set the context on the partial:
``` handlebars
\{{> module panel-inverse}}
\{{> module panel-success}}
\{{> module panel-info}}
Or on the section tags:
``` handlebars
\{{> module }}
You can’t perform that action at this time.