Skip to content

Commit

Permalink
Relative destinations. If you omit the dest field then the task will …
Browse files Browse the repository at this point in the history
…now place compiled js files in the same folder as the src file.
  • Loading branch information
petebacondarwin committed Jul 20, 2012
1 parent 123414e commit 19cb4ce
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tasks/coffee.js
Expand Up @@ -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 ) {
Expand All @@ -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.