编译CoffeeScript保存? [英] Compile CoffeeScript on Save?

查看:113
本文介绍了编译CoffeeScript保存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有反而易于编译CoffeeScript保存?我使用TextMate或Sublime Text 2。

Is there anyway to easily compile CoffeeScript on save? I'm using TextMate or Sublime Text 2.

推荐答案

Coffeescript有一个监视功能。您可以设置为半永久性过程:

Coffeescript has a 'watch' feature. You could set up, as a semi-permanent process:

coffee –wc -o media/js/ src/coffee/*.coffee

对于每个具有扩展名.coffee的文件,相应的编译.js

And for every file with an extension ".coffee", the corresponding compiled ".js" file will be put into the target directory every time you save.

也就是说,我使用makefile和fabfile,因为我的HTML是HAML,我的CSS是LessCSS,和我的开发目录不是我的测试路径,所以我需要一些聪明的构建和部署。

That said, I use a makefile and a fabfile, because my HTML is HAML, my CSS is LessCSS, and my development directory is not my test path, so I needed something smart enough to "build and deploy."

如果您的机器支持inotify,您可以使用inotifywait来观察整个工作路径,并根据需要调用Make。但在这一点上,你进入了硬核的geekery。

If your machine supports inotify, you could use inotifywait to watch your entire work path, and call Make as needed. But at that point, you're into hard-core geekery.

这篇关于编译CoffeeScript保存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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