title: CoffeeScript compiler API
body: <p>I am working in CoffeeScript (writing a Cakefile). I would like to compile some other CoffeeScript files, à la</p>
  
  <pre><code>coffee -o lib -c src
  </code></pre>
  
  <p>I could launch the above command in a child process, but this approach has cross-platform issues and makes error handling difficult. I'd much rather use an API.</p>
  
  <p>I'd be happy to use the exact functions from <a href="http://coffeescript.org/documentation/docs/command.html" rel="nofollow">command.coffee</a>, but I can't work out how.</p>
  
  <p>Addendum: I see <a href="http://coffeescript.org/documentation/docs/coffee-script.html" rel="nofollow"><code>require('coffee-script').compile</code></a>, which compiles a string to another string. That would still leave me to do the grunt work of looping over files and subfolders and writing the output.</p>