Skip to content

Instantly share code, notes, and snippets.

@jkneb
Created July 24, 2013 16:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkneb/6072299 to your computer and use it in GitHub Desktop.
Save jkneb/6072299 to your computer and use it in GitHub Desktop.
grunt-ember-handlebars plugin config for the Gruntfile + package.json. You'll have to update the Gruntfile with YOUR correct path to templates files. 1. Run `npm install` 2. Run `grunt` or `grunt watch`
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON( 'package.json' ),
ember_handlebars: {
options: {
processName: function(filePath) {
var shortFilePath = filePath.replace(/assets\/js\/app\/templates\//, '').replace('.hbs', '');
return shortFilePath;
},
processPartialName: function(filePath) {
var shortFilePath = filePath.replace(/assets\/js\/app\/templates\//, '').replace('.hbs', '');
return shortFilePath;
}
},
compile: {
files: {
'assets/js/app/templates.js': 'assets/js/app/templates/**/*.hbs'
}
}
},
watch: {
ember_handlebars: {
files: 'assets/js/app/templates/**/*.hbs',
tasks: ['ember_handlebars']
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-ember-handlebars');
// Default task(s).
grunt.registerTask('default', ['ember_handlebars']);
};
{
"name": "Your-Name-App-Hiphenated",
"description": "Write what u want",
"version": "0.0.1",
"private": true,
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-watch": "~0.4.4",
"grunt-ember-handlebars": "*"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment