问题
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