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

查看:15
本文介绍了在保存时编译 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.但到那时,你就陷入了顽固的极客中.

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天全站免登陆