Created
November 7, 2011 21:40
-
-
Save attaboy/1346280 to your computer and use it in GitHub Desktop.
Destroy the localStorage copy of less.js client-side-generated CSS
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
// Destroys the localStorage copy of CSS that less.js creates | |
function destroyLessCache(pathToCss) { // e.g. '/css/' or '/stylesheets/' | |
if (!window.localStorage || !less || less.env !== 'development') { | |
return; | |
} | |
var host = window.location.host; | |
var protocol = window.location.protocol; | |
var keyPrefix = protocol + '//' + host + pathToCss; | |
for (var key in window.localStorage) { | |
if (key.indexOf(keyPrefix) === 0) { | |
delete window.localStorage[key]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've included this modified / improved version:
https://gist.github.com/nezzario/8c96eb0cbfce280e6bf6
In my project here:
http://www.github.com/nezzario/kickoff
Thanks a ton for this!