Skip to content

Instantly share code, notes, and snippets.

@StanAngeloff
Created August 18, 2010 09:37
Show Gist options
  • Save StanAngeloff/534178 to your computer and use it in GitHub Desktop.
Save StanAngeloff/534178 to your computer and use it in GitHub Desktop.
require 'b'
this_ is_ file_ a
this_ is_ from_ b_
$ coffee -p -r ./require.coffee a.coffee
(function() {
this_(is_(from_(b_))); this_(is_(file_(a)));
})();
fs = require 'fs'
CoffeeScript.on 'success', (task) ->
return unless task.output
task.output = task.output.replace /[ \t]*require\(['"]([^'"]+).\);[\r\n]*/g, (line, file) ->
CoffeeScript.compile fs.readFileSync(fs.realpathSync("./#{file}.coffee"), 'utf8'), noWrap: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment