grunt-template-cache
v0.0.5
Published
Prepares template cache
Downloads
4
Readme
Cache mustachejs templates
Just a simple grunt file that will save mustachejs templates into a json file.
Add this task
grunt.loadNpmTasks('grunt-template-cache');
Configuration
"template-cache": {
"html": {
"glob": "views/**/*.html",
"dest": "templates.json",
},
},
This will generate something like:
{
"path/to/home.html": "<p>{{ value }}</p>",
//...
}
If you have a source or dist folder (or any other parent folder) that you want
to filter out you can use the regex_path_filter
"html": {
"glob": "src/views/**/*.html",
"dest": "templates.json",
"regex_path_filter": /^src\//i
},
},
and any src/path/to/file.html
will be path/to/file.html
Run it
grunt template-cache:html