diff --git a/lib/command.js b/lib/command.js index 47e84141..b923d7c8 100644 --- a/lib/command.js +++ b/lib/command.js @@ -62,6 +62,9 @@ base = path.join(source); compile = function(source, sourceIndex, topLevel) { return path.exists(source, function(exists) { + if (topLevel && !exists && source.lastIndexOf(".coffee") === -1) { + return compile(source + ".coffee", sourceIndex, topLevel); + } if (topLevel && !exists) { throw new Error("File not found: " + source); } diff --git a/src/command.coffee b/src/command.coffee index 0e2f438e..5c008b8d 100644 --- a/src/command.coffee +++ b/src/command.coffee @@ -78,6 +78,9 @@ compileScripts = -> base = path.join(source) compile = (source, sourceIndex, topLevel) -> path.exists source, (exists) -> + if topLevel and not exists and source.lastIndexOf(".coffee") == -1 + return compile source + ".coffee", sourceIndex, topLevel + throw new Error "File not found: #{source}" if topLevel and not exists fs.stat source, (err, stats) -> throw err if err