grunt-commonjs-handlebars
Precompile Handlebars templates into commonjs modules.
Getting Started
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, install this plugin with this command:
npm install grunt-commonjs-handlebars --save-dev
Handlebars task
Run this task with the grunt handlebars
command.
This task is a [multi task][] so any targets, files and options should be specified according to the [multi task][] documentation. [multi task]: https://github.com/gruntjs/grunt/wiki/Configuring-tasks
Usage Examples
handlebars: {
dist: {
files: {
"path/to/result.js": "path/to/source.hbs",
"path/to/another.js": ["path/to/sources/*.hbs", "path/to/more/*.hbs"]
}
},
//This is an example to convert each .hbs into its own .js file.
dev: {
files: grunt.file.expandMapping(['app/views/templates/**/*.hbs'], 'tmp/views/templates/', {
rename: (destBase, destPath) ->
return destBase + destPath.split('app/views/templates/')[1].replace /\.hbs$/, '.js'
})
}
}
Release History
- 2013-01-22 v0.1.0rc7 Initial release.
License
Copyright (c) 2012 Team Delicious, AVOS Systems Inc., Tim Branyen, contributors Licensed under the MIT license.