`
gazeldx
  • 浏览: 102057 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

coffee script js初体验

 
阅读更多
http://jashkenas.github.com/coffee-script/
需要先装Node.js,后装npm(一个安装器)

$curl http://npmjs.org/install.sh | sudo sh
解决安装npm不成功的问题

$coffee --join project.js --compile *.coffee 将当前目录下的所有.coffee文件编译为js后并且压缩到project.js中
$ coffee --compile dishes.js.coffee 将dishes.js.coffee编译为dishes.js,如果用-c代替--compile的话,则会编译为dishes.js.js

coffeescript里面不允许直接写ruby代码,可以通过这样的方式调用ruby的值:
:javascript
  user_name = "#{@user.name}";
xxx.js.coffee
this.dishNextStep = ->
  alert user_name

参考:
https://github.com/isaacs/npm/issues/902
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics