diff --git a/lib/less/browser.js b/lib/less/browser.js index 60119e6..a4ddd32 100644 --- a/lib/less/browser.js +++ b/lib/less/browser.js @@ -67,7 +67,8 @@ function loadStyleSheets(callback) { function loadStyleSheet(sheet, callback) { var css = typeof(localStorage) !== "undefined" && localStorage.getItem(sheet.href); - var styles = css && JSON.parse(css); + var timestamp = typeof(localStorage) !== "undefined" && localStorage.getItem(sheet.href + ':timestamp'); + var styles = { css: css, timestamp: timestamp }; xhr(sheet.href, function (data, lastModified) { if (styles && (new(Date)(lastModified).valueOf() === @@ -123,7 +124,8 @@ function createCSS(styles, sheet, lastModified) { // Don't update the local store if the file wasn't modified if (lastModified && typeof(localStorage) !== "undefined") { - localStorage.setItem(sheet.href, JSON.stringify({ timestamp: lastModified, css: styles })); + localStorage.setItem(sheet.href, styles); + localStorage.setItem(sheet.href + ':timestamp', lastModified); } }