Skip to content

Commit

Permalink
Fixed CoffeeScript support on Node 0.3+
Browse files Browse the repository at this point in the history
  • Loading branch information
jannehietamaki authored and Alexis Sellier committed Mar 13, 2011
1 parent 697ada4 commit 381c0a3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bin/vows
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ var fileExt, specFileExt;

try {
var coffee = require('coffee-script');
require.registerExtension('.coffee', function (content) { return coffee.compile(content) });
if(require.extensions) {
require.extensions['.coffee'] = function(module, filename) {
var content = coffee.compile(fs.readFileSync(filename, 'utf8'));
return module._compile(content, filename);
};
} else {
require.registerExtension('.coffee', function (content) { return coffee.compile(content) });
}
fileExt = /\.(js|coffee)$/;
specFileExt = /[.-](test|spec)\.(js|coffee)$/;
} catch (_) {
Expand Down

0 comments on commit 381c0a3

Please sign in to comment.