Compiles handlebar templates, outputs static HTML
Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-compile-handlebars
Then add this line to your project's grunt.js
gruntfile:
grunt.loadNpmTasks('grunt-compile-handlebars');
patrick kettner - a web developer who consistently worked with large static data sets.
grunt-compile-handlebars takes in a handlebars tempalte (and optionally static pre and post html), runs a dataset over it, and outputs static html.
inside of a grunt task. I assume you know what gruntjs is, but if not - gruntjs.com
this questions doesn't even make sense
Inside your grunt.js file:
'compile-handlebars': {
development: {
preHTML: 'src/pre.html',
postHTML: 'src/post.html',
template: 'index.handlebars',
output: 'dist/index.html',
templateData: {
foo: 'bar'
}
},
staging: {
template: 'index.handlebars',
output: 'dist/index.html',
templateData: '<json:src/staging.json>'
}
}
I had to work with several hundred repeated data structures that never changed. Keeping them all in html was silly, but pushing out a template engine for the end user to compile the same information multiple times was even sillier. This allows you to have your templated cake and eat it too.
- 0.0.2 - Inez changed to grunt's native json parser (thanks to @sebslomski). Updated Readme
- 0.0.1 - Dudley Initial commit
Copyright (c) 2012 Patrick Kettner Licensed under the MIT license.