Last active
December 18, 2015 19:09
-
-
Save padolsey/5830966 to your computer and use it in GitHub Desktop.
Reload stylesheets every 2s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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