5 ms·
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
by endtime 16y ago
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.
- jashkenas 16y agoI'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.