grunt-template-cache

0.0.5 • Public • Published

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

Package Sidebar

Install

npm i grunt-template-cache

Weekly Downloads

1

Version

0.0.5

License

none

Last publish

Collaborators

  • wdalmut