Compile templates with grunt

This commit is contained in:
Mattias Erming 2014-10-08 21:15:57 +02:00
parent b463ec7489
commit a406e52721
3 changed files with 19 additions and 20 deletions

View file

@ -18,8 +18,24 @@ module.exports = function(grunt) {
});
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.registerTask(
"handlebars",
function() {
grunt.util.spawn({
cmd: "node",
args: [
"node_modules/handlebars/bin/handlebars",
"client/views/",
"-e", "tpl",
"-f", "client/js/shout.templates.js"
]
}, function(err) {
if (err) console.log(err);
});
}
);
grunt.registerTask(
"default",
["uglify"]
["uglify", "handlebars"]
);
};

View file

@ -1,18 +0,0 @@
#!/bin/bash
#
# This file will compile the javascript libraries and
# the Handlebars templates.
#
# Install Handlebars
if ! type handlebars &> /dev/null; then
sudo npm -g install handlebars
fi
# Compile the templates
handlebars -e tpl -f client/js/shout.templates.js client/views/
# Uglify the javascript libraries
# See: Gruntfile.js
grunt uglify

View file

@ -47,6 +47,7 @@
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-watch": "^0.6.1"
"grunt-contrib-watch": "^0.6.1",
"handlebars": "^2.0.0"
}
}