From a406e527211292508a0f637db8ca38e32505ee58 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Wed, 8 Oct 2014 21:15:57 +0200 Subject: [PATCH] Compile templates with grunt --- Gruntfile.js | 18 +++++++++++++++++- build.sh | 18 ------------------ package.json | 3 ++- 3 files changed, 19 insertions(+), 20 deletions(-) delete mode 100755 build.sh diff --git a/Gruntfile.js b/Gruntfile.js index 9a03762d..625bfd2d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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"] ); }; diff --git a/build.sh b/build.sh deleted file mode 100755 index 36ee2dec..00000000 --- a/build.sh +++ /dev/null @@ -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 diff --git a/package.json b/package.json index f1e03150..f699c309 100644 --- a/package.json +++ b/package.json @@ -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" } }