2 ms·
I'm sorry -- if you'd like to use the compiler directly, here's an example: fs: require 'fs' fs.readFile source, (err, code) -> try js:
by jashkenas 16y ago
I'm sorry -- if you'd like to use the compiler directly, here's an example:
fs: require 'fs'
fs.readFile source, (err, code) ->
try
js: CoffeeScript.compile(code.toString(), {source})
fs.writeFile 'out.js', js
catch err
console.log err
Here's the source of the "CoffeeScript.compile" method:
http://jashkenas.github.com/coffee-script/documentation/docs/coffee-script.html#section-5 http://jashkenas.github.com/coffee-script/documentation/docs...
- endtime 16y agoOh, cool, thanks. I also just learned that {source} is short for {source: source}. That's something else missing from the docs, I believe.