我应该怎么做才能在Locomotivejs中设置coffeescript。
看起来很容易,但我无法理解。
我在“all.js”中设置选项,没有运气。
我想我差不多到了或者做得很远。 :(
this.set("options",{coffee:true});
感谢任何帮助。
答案 0 :(得分:3)
您需要添加server.js
文件并使用CoffeeScript支持启动机车,如下所示:
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);
)
)
启动应用程序:
$ node server
此拉取请求中有更多信息: https://github.com/jaredhanson/locomotive/pull/44
对lcm
命令行的--coffee选项的支持将添加到即将发布的版本中。