don't use a timer to load the stylesheets, or the body starts loading too early

This commit is contained in:
cloudhead
2010-06-14 21:19:39 -04:00
parent 4135ccf010
commit 7b990c656a

View File

@@ -14,23 +14,16 @@ less.env = location.hostname == '127.0.0.1' ||
less.watch = function () { return this.watchMode = true };
less.unwatch = function () { return this.watchMode = false };
// Load the stylesheets when the body is ready
var readyTimer = setInterval(function () {
if (document.body) {
sheets = select('link[rel="stylesheet/less"]');
sheets = select('link[rel="stylesheet/less"]');
clearInterval(readyTimer);
loadStyleSheets(function (root, sheet, env) {
if (env.local) {
log("less: loading " + sheet.href + " from local storage.");
} else {
createCSS(root.toCSS(), sheet, env.lastModified);
log("less: parsed " + sheet.href + " successfully.");
}
});
loadStyleSheets(function (root, sheet, env) {
if (env.local) {
log("less: loading " + sheet.href + " from local storage.");
} else {
createCSS(root.toCSS(), sheet, env.lastModified);
log("less: parsed " + sheet.href + " successfully.");
}
}, 10);
});
if (less.env === 'development' && /!refresh/.test(location.hash)) {
less.watchMode = true;