Compile mustache or hbs templates.
This plugin requires Grunt ~0.4.2
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-mustache-html --save-devOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-mustache-html');Generate static HTML file from mustache|hbs JST for static HTML docs.
grunt.initConfig({
mustache_html: {
development: {
options: {
src: 'src',
dist: 'dist',
type: 'mustache' // mustache Or hbs
},
globals: {
analytics_id: 'UA-123456-1'
}
}
}
});Now the subtask mustache_html:development is available.
Type: String
Default value: src
The source directory of your templates, the directory should be structured like:
.
├── layout.mustache
├── pages
│ └── index.json
│ └── index.mustache
└── partials
├── nav.json
└── nav.mustachelayout.mustachemust exist, and its name should have prefixlayoutpagescontains the page templates that are eventually created,.jsoncontains the page specify data which can be also rendered in layout page. Use{{>content}}inlayout.mustacheto paste the page's content in.partialscontains the partial templates that might be used in the page templates,.jsoncontains the json formatted data, its name must be the save as the partial's.
Type: String
Default value: dist
The destination directory of the created HTML files.
Type: String
Default value: mustache
The type of JST, can be mustache or hbs.
Type: Object
Default value: {}
Contains global data. May be used to define environment-specific variables
Run grunt test.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
(Nothing yet)