Search code examples
coffeescript

CoffeeScript.compile() list of accepted parameters


Using http://coffeescript.org/extras/coffee-script.js directly, what are the parameters accepted by the function compile() ?

So far, I can see two parameters:

  1. The CoffeeString to compile into JavaScript
  2. An object used as options for the compiler

Is there other parameters?

What are the supported options for the second parameter? So far, I only managed to make bare: on/off work. Is there something else?


Solution

  • Why not read the literate source and not the minified one? I can see:

    • header: do we surround it with "// Generated by CoffeeScript blah blah"?
    • filename: for reporting error messages
    • sandbox: a context to execute code in for eval
    • modulename: the name for the created module when evalling

    The same options are then used with the name o in nodes.coffee, and some state is passed around in it from there on.