Skip to content
Browse files

Support for IcedCoffeeScript. If iced is not found it will fallback t…

…o coffee.
  • Loading branch information...
1 parent adc39f6 commit 32cccc6151834643f0eee8e0b339ac5f5387d502 @Akkuma committed
Showing with 13 additions and 2 deletions.
  1. +13 −2 lib/node.io/utils.js
View
15 lib/node.io/utils.js
@@ -79,9 +79,20 @@ exports.removeOnExit = function (file) {
* @api public
*/
exports.compileCoffee = function (coffee_file, compiled_file, callback) {
- exec('coffee -p -c "' + coffee_file + '"', {cwd: cwd}, function (err, stdout, stderr) {
+ exec('iced -p -c "' + coffee_file + '"', {cwd: cwd}, function (err, stdout, stderr) {
if (err || stderr) {
- callback(err || stderr);
+ if (!stderr || (stderr && stderr.indexOf("iced: not found") === -1)) {
+ callback(err || stderr);
+ } else {
+ exec('coffee -p -c "' + coffee_file + '"', {cwd: cwd}, function (err, stdout, stderr) {
+ if (err || stderr) {
+ callback(err || stderr);
+ } else {
+ exports.removeOnExit(compiled_file);
+ fs.writeFile(compiled_file, stdout, callback);
+ }
+ });
+ }
} else {
exports.removeOnExit(compiled_file);
fs.writeFile(compiled_file, stdout, callback);

1 comment on commit 32cccc6

@jbergstroem

This is a slippery slope. I'd keep such a patch local or perhaps set an option for calling whatever script (with args).

Please sign in to comment.
Something went wrong with that request. Please try again.