npm install grunt-template-cacheJust a simple grunt file that will save mustachejs templates into a json file.
``js`
grunt.loadNpmTasks('grunt-template-cache');
`js`
"template-cache": {
"html": {
"glob": "views/*/.html",
"dest": "templates.json",
},
},
This will generate something like:
` {{ value }}json`
{
"path/to/home.html": "
//...
}
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
`js`
"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
`sh``
grunt template-cache:html