问题描述
如何在 Locomotivejs 中设置 coffeescript.
What should I do to set coffeescript in Locomotivejs.
这似乎很容易,但我想不通.
It seems very easy, but I couldn't figure that out.
我在all.js"中设置了选项,没有运气.
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});
感谢任何帮助.
推荐答案
您需要添加一个 server.js
文件并使用 CoffeeScript 支持启动 Locomotive,如下所示:
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);
)
)
启动应用程序:
$ node server
此拉取请求中有更多信息:https://github.com/jaredhanson/locomotive/pull/44
There's more info in this pull request: https://github.com/jaredhanson/locomotive/pull/44
将在即将发布的版本中添加对 lcm
命令行的 --coffee 选项的支持.
Support for a --coffee option to the lcm
command line will be added to an upcoming release.
这篇关于如何在 Locomotivejs 中设置咖啡脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!