Re:CoffeeScript -- You Are Totally Gonna Hate It
by endtime on Sunday July 18, 2010 @01:15AM
(#1525276)
Thanks Jeremy. I don't particularly want to use child_process.exec if there's a better/more direct way to compile, which it seems like there must be. I think it would be really helpful to have a dead simple Cakefile example for compiling a single CS file into a single JS file. It's not clear to me what the standard way to do that is, even with your new example.
[ Parent
| on HN ]
Re:CoffeeScript -- You Are Totally Gonna Hate It
by jashkenas on Sunday July 18, 2010 @07:46AM
(#1525608)
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...