How do I set coffescript in Locomotivejs?(如何在 Locomotivejs 中设置咖啡脚本?)
问题描述
如何在 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 中设置咖啡脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 Locomotivejs 中设置咖啡脚本?


基础教程推荐
- Bokeh Div文本对齐 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01