How do I set coffescript in Locomotivejs?


What should I do to set coffeescript in Locomotivejs.

It seems very easy, but I couldn't figure that out.

I set options in "all.js", without luck.

I think I'm almost there or very far to get it right. :(


Any help is appreciated.

Problem courtesy of: mrocha


You'll want to add a server.js file and boot Locomotive with CoffeeScript support, like so:

locomotive = require('locomotive')

locomotive.boot('.', 'development', {"coffeeScript": true}, (err, server) -> 
  throw err if (err)

  server.listen(3000, 'localhost', ()-> 
    addr = this.address()
    console.log('listening on %s:%d', addr.address, addr.port);

To start the app:

$ node server

There's more info in this pull request:

Support for a --coffee option to the lcm command line will be added to an upcoming release.

Solution courtesy of: Jared Hanson


There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.