diff --git a/package.json b/package.json index 2ceb921..67e4447 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "grunt": "~0.3.10", - "handlebars": "1.0.5beta" + "handlebars": "1.0.7" }, "devDependencies": { "mocha": "~1.2.1", diff --git a/tasks/handlebars.js b/tasks/handlebars.js index d208f74..5e0d19e 100644 --- a/tasks/handlebars.js +++ b/tasks/handlebars.js @@ -23,16 +23,24 @@ module.exports = function(grunt) { if (process.platform == "win32") { // win32 cmd doesn't know what "&&" is and is also not able to use wildcards // anyway this will match all the files in the template dir anyway. - finalCmd = __dirname + '/../node_modules/.bin/handlebars -m ' + templateDir + '/ -f ' + this.file.dest; + finalCmd = '"'+__dirname + '/../node_modules/.bin/handlebars" -m ' + templateDir + '/ -f ' + this.file.dest; } else { // others platform, set to the default command finalCmd = truncateFileCmd +' && '+ handlebarsCmd; } + // Check if we want to build it AMD style + var amdSuffix=''; + if ("undefined" !== typeof this.data.amd && this.data.amd) { + amdSuffix=' -a'; + } + + // Update finalCmd + finalCmd += amdSuffix; exec(finalCmd, function(err, stdout, stderr) { if (err) { grunt.fail.fatal(stderr); - } + } done(); }); }); diff --git a/test/grunt.js b/test/grunt.js index f4be40b..5ad3d56 100644 --- a/test/grunt.js +++ b/test/grunt.js @@ -6,6 +6,7 @@ module.exports = function(grunt) { all: { src: 'fixtures', dest: 'fixtures/output/templates.js' + //amd:true } } });