From 8c7986109f1d60fcd06a0fdaac2cc2acb61827b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20=C3=96rn=20Nielsen?= Date: Mon, 2 Sep 2013 11:18:54 +0000 Subject: [PATCH] Handle HAML compile errors and output message to the console. --- src/ruby-haml.coffee | 3 +++ tasks/ruby-haml.js | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/ruby-haml.coffee b/src/ruby-haml.coffee index 1a40b65..1d8f9a5 100644 --- a/src/ruby-haml.coffee +++ b/src/ruby-haml.coffee @@ -15,6 +15,9 @@ module.exports = (grunt) -> args: [ "--unix-newlines", "--no-escape-attrs", "--double-quote-attributes", src ] grunt.util.spawn args, (err, result) -> + if err + grunt.log.error 'Error compiling ' + src + return done err [ext, result] = if options.templatize [".js", "define(function() { return " + _.template(result.stdout).source + "});"] else diff --git a/tasks/ruby-haml.js b/tasks/ruby-haml.js index a744655..0be5c94 100644 --- a/tasks/ruby-haml.js +++ b/tasks/ruby-haml.js @@ -13,6 +13,10 @@ }; return grunt.util.spawn(args, function(err, result) { 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]; dest = destPath; destPath = (dest ? dest : path.dirname(src));