4 ms·
It would be nice to have some information about the inner workings of the script on the site. The actual script on the site is unminified and quite easy to gra
by juriga 15y ago
It would be nice to have some information about the inner workings of the script on the site.
The actual script on the site is unminified and quite easy to grasp: Since it's only a client-side solution it has to resort to polling every stylesheet every second(!) and check the file's Last-Modified header from the ajax request.
This is hardly an optimal solution, since you end up making a lot of requests even though no changes are being made. In addition to the performance standpoint, you end up cluttering any ajax monitoring views (e.g. Chrome dev tools).
LiveReload (http://livereload.com/ http://livereload.com/) seems to be a good alternative (Mac only). Any suggestions for similar solutions for other OSes?
EDIT: Just tried the experimental v0.0.2 Windows release of LiveReload. Installation was really easy, and I got it working with the Firefox extension right away. More info: http://help.livereload.com/kb/roadmap/latest-development-builds http://help.livereload.com/kb/roadmap/latest-development-bui...
- MatthewPhillips 15y agoI don't see an issue with the polling. You're only ever going to use this in dev, I don't care that it polls my localhost frequently. If I'm optimizing my own JavaScript I won't have it enabled. The bookmarklet seems the way to go. Enable it while you're working on CSS, otherwise you don't need it.
- mradmin 15y agoI agree with your points. Polling is not the right approach IMO. A much simpler approach would be to use the following script as a bookmark, and hit the bookmark when you want to see the changes: javascript:(function(){var%20s,i,x;x=document.getElementsByTagName('link');for(i=0;i<x.length;i++){x[i].href=x[i].href+'?'+new%20Date().getTime();}})();