grunt-caveman
Advanced tools
Comparing version
{ | ||
"name": "grunt-caveman", | ||
"description": "Pre-compile Caveman templates.", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"homepage": "https://github.com/andrewchilds/grunt-caveman", | ||
@@ -18,3 +18,3 @@ "author": { | ||
"dependencies": { | ||
"caveman": "0.1.3", | ||
"caveman": "0.1.4", | ||
"lodash": "2.4.1" | ||
@@ -21,0 +21,0 @@ }, |
@@ -30,3 +30,3 @@ # grunt-caveman | ||
### Using pre-compiled templates on the client | ||
### Rendering pre-compiled templates on the client-side: | ||
@@ -45,2 +45,6 @@ ```js | ||
src: ['path/to/templates/*.html'], | ||
data: { | ||
foo: [1, 2, 3], | ||
bar: true | ||
}, | ||
render: { | ||
@@ -47,0 +51,0 @@ 'indexPage': 'public/index.html', |
@@ -23,2 +23,6 @@ /* | ||
src: ['path/to/templates/*.html'], | ||
data: { | ||
foo: [1, 2, 3], | ||
bar: true | ||
}, | ||
render: { | ||
@@ -40,3 +44,3 @@ 'indexPage': 'public/index.html', | ||
if (this.data.src && this.data.render) { | ||
exports.compileAndRenderTemplates(grunt, this.data.src, this.data.render); | ||
exports.compileAndRenderTemplates(grunt, this.data.src, this.data.render, this.data.data); | ||
} | ||
@@ -71,3 +75,3 @@ }); | ||
exports.compileAndRenderTemplates = function (grunt, src, files) { | ||
exports.compileAndRenderTemplates = function (grunt, src, files, data) { | ||
var path = require('path'); | ||
@@ -92,5 +96,5 @@ var Caveman = require('caveman'); | ||
_.each(files, function (dest, template) { | ||
grunt.file.write(dest, Caveman.render(template)); | ||
grunt.file.write(dest, Caveman.render(template, data || {})); | ||
grunt.log.writeln(template.cyan + ' -> ' + dest.cyan); | ||
}); | ||
}; |
5375
3.03%80
5.26%60
7.14%+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated