-
-
Save attilagyorffy/1351966 to your computer and use it in GitHub Desktop.
Destroy the localStorage copy of less.js client-side-generated CSS
This file contains 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