Skip to content
thegrandpoobah edited this page Jun 20, 2012 · 4 revisions

Mustache Syntax: Partials

Description

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.

Examples

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     }}

Clone this wiki locally