forked from janl/mustache.js
-
Notifications
You must be signed in to change notification settings - Fork 2
Syntax Partials
thegrandpoobah edited this page Jun 20, 2012
·
4 revisions
Partial tags are the "import" mechanism of Mustache. They are useful for breaking up a large markup file into multiple smaller files.
Partial tags are opened with the {{> token and closed with the }} token. The content within the tags constitutes the tag name and is used to perform lookups into the data set. The tag name cannot include whitespace except as prefix or postfix. All other characters are valid tag names.
Partial tags obey the Change Delimiter command.
The following line of JavaScript code:
Mustache.to_html('{{>a_partial}}', { bugs: 'bunny' }, { a_partial: '{{bugs}}' });
Will output the following result:
'bunny'
Whitespaces are only okay as prefixes and postfixes:
{{> bugs }}