Skip to content

Instantly share code, notes, and snippets.

@padolsey
Last active December 18, 2015 19:09
Show Gist options
  • Select an option

  • Save padolsey/5830966 to your computer and use it in GitHub Desktop.

Select an option

Save padolsey/5830966 to your computer and use it in GitHub Desktop.
Reload stylesheets every 2s
(function() {
var all = document.querySelectorAll('link[rel=stylesheet]');
var i = setInterval(function() {
for (var l = all.length; l--;) {
var href = all[l].href;
href = href.replace(/[&\?]__reloader__=\d+/, '');
href += (href.indexOf('?') > -1 ? '&' : '?') + '__reloader__=' + +new Date;
all[l].href = href;
}
}, 2000);
return function() {
clearInterval(i);
};
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment