且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在保存时编译 CoffeeScript?

更新时间:2023-10-06 12:50:16

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.