如何在Locomotivejs中设置coffescript? [英] How do I set coffescript in Locomotivejs?

查看:149
本文介绍了如何在Locomotivejs中设置coffescript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该怎么做在Locomotivejs中设置coffeescript。



这很容易,但我无法想象。



我在all.js中设置了选项,没有运气。



我想我几乎在那里, :(

  this.set(options,{coffee:true}); 
解决方案

您将需要添加 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('listen on%s:%d',addr.address,addr.port);


要启动应用程序:

  $ node server 

此请求中有更多信息:
https://github.com/jaredhanson/locomotive/pull/44



支持a - lcm 命令行的-coffee选项将添加到即将推出的版本。


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.

解决方案

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.

这篇关于如何在Locomotivejs中设置coffescript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆