Revisions
-
davidnpma revised this gist
Feb 13, 2012 . 1 changed file with 2 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,13 +21,11 @@ task.registerBasicTask("coffee", "Compile coffee files to js", function(data, na task.registerHelper('coffee', function(filepath /* String */, callback /* [Function] */) { var coffee = require('coffee-script'); try { var js = coffee.compile(file.read(filepath)); if (js) file.write(filepath.replace(/\.coffee$/, '.js'), js); } catch (e) { log.error(e.message); -
davidnpma revised this gist
Feb 13, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,7 @@ task.registerHelper('coffee', function(filepath /* String */, callback /* [Funct var coffee = require('coffee-script'), fileName = filepath.match(/\/[a-z|A-Z|_]*\.coffee$/)[0].slice(1), jsPath = filepath.replace(/\.coffee$/, '.js'); try { var js = coffee.compile(file.read(filepath)); -
davidnpma created this gist
Feb 13, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ /* * Grunt Task File * --------------- * * Task: coffee * Description: Compile coffee files to js * Dependencies: coffee-script * */ task.registerBasicTask("coffee", "Compile coffee files to js", function(data, name) { var files = file.expand(data); // files array contains filepath as strings // compile each coffee-sciprt file to js files.forEach(function(filepath) { // compile and write to file task.helper('coffee', filepath); }); }); task.registerHelper('coffee', function(filepath /* String */, callback /* [Function] */) { var coffee = require('coffee-script'), fileName = filepath.match(/\/[a-z|A-Z|_]*\.coffee$/)[0].slice(1), jsPath = 'modules/'+fileName.replace('coffee', 'js'); try { var js = coffee.compile(file.read(filepath)); if (js) file.write(jsPath, js); } catch (e) { log.error(e.message); } });