Permalink
Browse files

Relative destinations. If you omit the dest field then the task will …

…now place compiled js files in the same folder as the src file.
  • Loading branch information...
1 parent 123414e commit 19cb4ce82665cd1cdcbda7923cf000d19ce4f996 @petebacondarwin petebacondarwin committed Jul 20, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 tasks/coffee.js
View
@@ -36,8 +36,8 @@ module.exports = function(grunt) {
var coffee = require('coffee-script'),
js = '';
- var dest = path.join(destPath,
- path.basename(src, '.coffee') + '.js');
+ destPath = destPath ? destPath : path.dirname(src);
+ var dest = path.join(destPath, path.basename(src, '.coffee') + '.js');
options = options || {};
if( options.bare !== false ) {
@@ -46,10 +46,10 @@ module.exports = function(grunt) {
try {
js = coffee.compile(grunt.file.read(src), options);
+ grunt.file.write(dest, js);
} catch (e) {
- grunt.log.error("Error in " + src + ":\n" + e);
+ grunt.log.error("Unable to compile your coffee", e);
}
- if (this.errorCount) { return false; }
- grunt.file.write(dest, js);
});
+
};

0 comments on commit 19cb4ce

Please sign in to comment.