webxl / grunt-reload

A grunt task and reverse proxy that enables live reloading of updated files in the browser.
MIT License
132 stars 19 forks source link

Compatibility for grunt 0.4.0 (fixes #13) #18

Closed manuel-woelker closed 11 years ago

manuel-woelker commented 11 years ago

Added some compatibility fixes for grunt 0.4.0.

Besides updating the gruntfile for 0.4.0, added a mechanism that triggers reloads via a HTTP request, which addresses the issue of grunt-watch now spawning tasks in their own process (see #13).

If you need any other changes, please let me know. Cheers!

webxl commented 11 years ago

Hi,

Thanks for looking at this. I was trying to test this locally and am not sure how to verify this is working correctly. Can you provide steps to test?

Matt

manuel-woelker commented 11 years ago

Sure, just open a basic grunt (0.4.0) project with a grunt-watch task triggering a grunt-reload task. Then start the task and modify a watched file.

With the currently released version, grunt-reload will fail whenever a file is changed, since grunt-watch always spawns a new grunt-reload process, which hasn't the servers variable set (see #13). This causes the new process to fail with Fatal error: listen EADDRINUSE. The original grunt-reload process never gets notified by watch, so it doesn't trigger a reload.

This patch enables grunt-reload to trigger the reload even if grunt-watch spawns it in a new process, by notifying the original process via an HTTP request. So you should see the file modifications reflected in the browser again.

If you need any further information, please let me know. Cheers!