how can I get connect-assets to recompile my coffee files when they change?

落花浮王杯 提交于 2019-12-12 20:59:26

问题


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

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.

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?

Edit: 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.


回答1:


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.



来源:https://stackoverflow.com/questions/14246535/how-can-i-get-connect-assets-to-recompile-my-coffee-files-when-they-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!