Handle HAML compile errors and output message to the console.

This commit is contained in:
Ólafur Örn Nielsen 2013-09-02 11:18:54 +00:00
parent 664328e95c
commit 8c7986109f
2 changed files with 7 additions and 0 deletions

View File

@ -15,6 +15,9 @@ module.exports = (grunt) ->
args: [ "--unix-newlines", "--no-escape-attrs", "--double-quote-attributes", src ] args: [ "--unix-newlines", "--no-escape-attrs", "--double-quote-attributes", src ]
grunt.util.spawn args, (err, result) -> grunt.util.spawn args, (err, result) ->
if err
grunt.log.error 'Error compiling ' + src
return done err
[ext, result] = if options.templatize [ext, result] = if options.templatize
[".js", "define(function() { return " + _.template(result.stdout).source + "});"] [".js", "define(function() { return " + _.template(result.stdout).source + "});"]
else else

View File

@ -13,6 +13,10 @@
}; };
return grunt.util.spawn(args, function(err, result) { return grunt.util.spawn(args, function(err, result) {
var dest, ext, _ref; var dest, ext, _ref;
if (err) {
grunt.log.error('Error compiling ' + src);
return done(err);
}
_ref = options.templatize ? [".js", "define(function() { return " + _.template(result.stdout).source + "});"] : ["html", result.stdout], ext = _ref[0], result = _ref[1]; _ref = options.templatize ? [".js", "define(function() { return " + _.template(result.stdout).source + "});"] : ["html", result.stdout], ext = _ref[0], result = _ref[1];
dest = destPath; dest = destPath;
destPath = (dest ? dest : path.dirname(src)); destPath = (dest ? dest : path.dirname(src));