How do I set coffescript in Locomotivejs?

为君一笑 提交于 2019-12-08 01:26:03

问题


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. :(

this.set("options",{coffee:true});

Any help is appreciated.


回答1:


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: https://github.com/jaredhanson/locomotive/pull/44

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



来源:https://stackoverflow.com/questions/14489677/how-do-i-set-coffescript-in-locomotivejs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!