Skip to content

Commit

Permalink
Merge remote-tracking branch 'emanuelbsilva/master'
Browse files Browse the repository at this point in the history
Brings in the original code from pull request #14 after reconciliation
with the newer code base.

Conflicts:
	README.md
	tasks/mustache_render.js
  • Loading branch information
corpulentcoffee committed Oct 18, 2014
2 parents 5270d99 + f6d90d6 commit c522c65
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -165,6 +165,12 @@ Default value: `undefined`

These two slots can be used to fill in a default `data` or `template` value for any item in your `files` list that does not already have one specified. This can be handy if you want to dynamically build the `files` list and apply the same `data` or `template` source to every item in the list.

### options.escape
Type: `Boolean`
Default value: `true`

If set to `false` it disables default HTML escaping. That means that `{{var}}` will not be escaped. This is usefull for templating files that are not HTML.

### Usage Examples

For this Grunt config:
Expand Down
7 changes: 6 additions & 1 deletion tasks/mustache_render.js
Expand Up @@ -21,7 +21,8 @@ module.exports = function gruntTask(grunt) {
prefix : "", // discouraged; use prefix_dir and/or prefix_file
prefix_dir : "",
prefix_file : "",
clear_cache : false
clear_cache : false,
escape: true
};

/**
Expand Down Expand Up @@ -316,6 +317,10 @@ module.exports = function gruntTask(grunt) {

if (renderer.options.clear_cache) { mustache.clearCache(); }

if (!renderer.options.escape) {
mustache.escape = function (text) { return text; }
}

Promise.all(files.map(function renderFile(fileData) {
return renderer.render(fileData.data, fileData.template, fileData.dest);
})).
Expand Down

0 comments on commit c522c65

Please sign in to comment.