mirror of
https://github.com/less/less.js.git
synced 2026-02-04 12:05:06 -05:00
don't use a timer to load the stylesheets, or the body starts loading too early
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user