1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

enabling compilation of non-.coffee-extension files passed directly to the coffee command (Issue #391)

This commit is contained in:
Jeremy Ashkenas 2010-05-31 15:36:41 -04:00
parent 39b8bbc39b
commit 300c711af1
2 changed files with 10 additions and 10 deletions

View file

@ -55,8 +55,8 @@
return compile_scripts();
};
// Asynchronously read in each CoffeeScript in a list of source files and
// compile them. If a directory is passed, recursively compile all source
// files in it and all subdirectories.
// compile them. If a directory is passed, recursively compile all
// '.coffee' extension source files in it and all subdirectories.
compile_scripts = function() {
var _b, _c, _d, _e, base, compile, source;
_b = []; _d = sources;
@ -64,7 +64,7 @@
source = _d[_c];
_b.push((function() {
base = source;
compile = function(source) {
compile = function(source, top_level) {
return path.exists(source, function(exists) {
if (!(exists)) {
throw new Error(("File not found: " + source));
@ -80,7 +80,7 @@
}
return _f;
});
} else if (path.extname(source) === '.coffee') {
} else if (top_level || path.extname(source) === '.coffee') {
fs.readFile(source, function(err, code) {
return compile_script(source, code.toString(), base);
});
@ -91,7 +91,7 @@
});
});
};
return compile(source);
return compile(source, true);
})());
}
return _b;