如何获取连接资产重新编译我的咖啡文件,当他们改变? [英] how can I get connect-assets to recompile my coffee files when they change?

查看:209
本文介绍了如何获取连接资产重新编译我的咖啡文件,当他们改变?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

相关,但希望有更低的摩擦回答:如何使用带coffeescript和requirejs的Node和Express?

Related, but hoping for a lower friction answer: How do I use Node and Express with coffeescript and requirejs?

我设置了连接资产,以便我可以有.js和.coffee文件并排在我的/ assets / js文件夹中。只有问题:我必须重新获取包含任何编译的咖啡文件的页面,只要这些文件更改。次要问题我猜,但我已经做了很多CURL对文件本身作为故障排除的一部分 - 做一个CURL上的咖啡js文件本身不会导致它被重新编译。

I've got connect-assets set up so that I can have .js and .coffee files side by side in my /assets/js folder. Only problem: I have to re-get the page containing any compiled coffee files whenever those files change. Minor problem I guess, but I've been doing a lot of CURL on the files themselves as part of troubleshooting -- doing a CURL on the coffee js file itself won't cause it to be recompiled.

连接资产是否具有任何类型的观看功能?在文档中找不到。我只需要在该目录中运行 coffee -bcw * .coffee

Does connect-assets have any sort of 'watch' feature? Couldn't find one in the docs. Do I have to just put a coffee -bcw *.coffee running in that directory?

编辑:最后我只是使用grunt重新编译更改。这比连接资产工作得更好。我会在这里留下这个问题,因为它有一些意见。

In the end I just used grunt to recompile on change. That's worked much better than connect-assets. I'll leave this question here because it's got some views.

推荐答案

我不知道我是否明白你要求100%,但是你考虑过使用 node-supervisor ?这可以查看CoffeeScript文件(和其他资源),并在修改后重新启动节点进程。我已成功使用它与连接资产。

I'm not sure if I understand what you're asking 100%, but have you considered using something like node-supervisor? This can watch CoffeeScript files (and other resources) and restart your node process when they're modified. I've used it with connect-assets successfully.

这篇关于如何获取连接资产重新编译我的咖啡文件,当他们改变?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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