Skip to content

Instantly share code, notes, and snippets.

@cschneider271
Forked from attaboy/gist:1346280
Created April 8, 2013 19:11
Show Gist options
  • Save cschneider271/5339571 to your computer and use it in GitHub Desktop.
Save cschneider271/5339571 to your computer and use it in GitHub Desktop.
// 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