(new) less.refreshStyles, and reload styles on refresh()
This commit is contained in:
parent
dd87c3bae9
commit
b8e6455d55
@ -72,17 +72,6 @@ for (var i = 0; i < links.length; i++) {
|
||||
}
|
||||
}
|
||||
|
||||
var styles = document.getElementsByTagName('style');
|
||||
|
||||
for (var i = 0; i < styles.length; i++) {
|
||||
if (styles[i].type.match(typePattern)) {
|
||||
new(less.Parser)().parse(styles[i].innerHTML || '', function (e, tree) {
|
||||
styles[i].type = 'text/css';
|
||||
styles[i].innerHTML = tree.toCSS();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var startTime = endTime = new(Date);
|
||||
|
||||
less.refresh = function (reload) {
|
||||
@ -97,10 +86,25 @@ less.refresh = function (reload) {
|
||||
(env.remaining === 0) && log("css generated in " + (new(Date) - startTime) + 'ms');
|
||||
endTime = new(Date);
|
||||
}, reload);
|
||||
|
||||
loadStyles();
|
||||
};
|
||||
less.refreshStyles = loadStyles;
|
||||
|
||||
less.refresh(less.env === 'development');
|
||||
|
||||
function loadStyles() {
|
||||
var styles = document.getElementsByTagName('style');
|
||||
for (var i = 0; i < styles.length; i++) {
|
||||
if (styles[i].type.match(typePattern)) {
|
||||
new(less.Parser)().parse(styles[i].innerHTML || '', function (e, tree) {
|
||||
styles[i].type = 'text/css';
|
||||
styles[i].innerHTML = tree.toCSS();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadStyleSheets(callback, reload) {
|
||||
for (var i = 0; i < less.sheets.length; i++) {
|
||||
loadStyleSheet(less.sheets[i], callback, reload, less.sheets.length - (i + 1));
|
||||
|
Loading…
Reference in New Issue
Block a user