Skip to content

Commit

Permalink
Support for IcedCoffeeScript. If iced is not found it will fallback t…
Browse files Browse the repository at this point in the history
…o coffee.
  • Loading branch information
Akkuma committed May 28, 2012
1 parent adc39f6 commit 32cccc6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/node.io/utils.js
Expand Up @@ -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);
Expand Down

0 comments on commit 32cccc6

Please sign in to comment.