cassette
cassette copied to clipboard
Support Live Browser Reload when in Debug Mode
When editing CSS / LESS or Javascript files, you could use a FileSystemWatcher to watch files for changes, and use something like WebSockets to push the changed Styles/Javascript down to the browser.
That'd be one awesome feature to have.
I agree :)
Probably using SignalR would be the easiest/cross-browser way to make this happen.
Yeah SignalR abstracts away the core networking plumming. I think you'd best use a PersistentConnection because it gives you a little more granular control than a Hub.
It's worth noting that WebSockets aren't supported in IIS until IIS 8 (Windows 8). You can use HTML5 Server-Sent Events with IIS 7, which would be fine for this purpose. You could make a basic version just using Server-sent events that only works in good (non-IE) browsers, without having to add a dependency on SignalR. Server-sent events are quite easy to use (a lot easier than WebSockets), see http://html5doctor.com/server-sent-events/ for example. They only allow one-way communication (from server to client) but this is sufficient for this.
I can imagine only developers using this feature, so having something that works in everything except IE may be okay.
Of course, if you want to add an optional SignalR dependency, it's definitely awesome. SignalR uses server-sent events, falling back to "forever iframes" and a few other transports for IE.
While this is a great feature it is independent from cassette.
And when goes to the implementation I'd use already written chrome plugin from https://github.com/livereload/LiveReload2 and write own server implementation with SignalR. Talking about integration with cassette - that msbuild script that build's stuff (coffeescript files, sass, less, etc.) should have the possibility to be ran as a part of livereload step (before sending to the server) and files generated by cassette shouldn't change hash in location path while working in this mode (in this scenario cassette just plays role of compiler for coffeescript files, sass, less, etc.).