mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
seperate sheet and env
This commit is contained in:
@@ -248,7 +248,12 @@ function extractUrlParts(url, baseUrl) {
|
||||
}
|
||||
|
||||
function loadStyleSheet(sheet, callback, reload, remaining) {
|
||||
loadFile(sheet, function(e, data, sheet, webInfo, path, env) {
|
||||
|
||||
var env = new less.tree.parseEnv(less);
|
||||
env.mime = sheet.type;
|
||||
env.currentFileInfo = null;
|
||||
|
||||
loadFile(sheet, env, function(e, data, sheet, webInfo, path, env) {
|
||||
if (webInfo) {
|
||||
webInfo.remaining = remaining;
|
||||
}
|
||||
@@ -268,7 +273,7 @@ function loadStyleSheet(sheet, callback, reload, remaining) {
|
||||
}, reload);
|
||||
}
|
||||
|
||||
function loadFile(sheet, callback, reload) {
|
||||
function loadFile(sheet, env, callback, reload) {
|
||||
|
||||
// sheet may be set to the stylesheet for the initial load or a collection of properties including
|
||||
// some env variables for imports
|
||||
@@ -277,21 +282,18 @@ function loadFile(sheet, callback, reload) {
|
||||
var css = cache && cache.getItem(href);
|
||||
var timestamp = cache && cache.getItem(href + ':timestamp');
|
||||
var styles = { css: css, timestamp: timestamp };
|
||||
var env;
|
||||
var newFileInfo = {
|
||||
relativeUrls: less.relativeUrls,
|
||||
currentDirectory: hrefParts.path,
|
||||
filename: href
|
||||
};
|
||||
|
||||
if (sheet instanceof less.tree.parseEnv) {
|
||||
env = new less.tree.parseEnv(sheet);
|
||||
if (env.currentFileInfo) {
|
||||
env = new less.tree.parseEnv(env);
|
||||
newFileInfo.entryPath = env.currentFileInfo.entryPath;
|
||||
newFileInfo.rootpath = env.currentFileInfo.rootpath;
|
||||
newFileInfo.rootFilename = env.currentFileInfo.rootFilename;
|
||||
} else {
|
||||
env = new less.tree.parseEnv(less);
|
||||
env.mime = sheet.type;
|
||||
newFileInfo.entryPath = hrefParts.path;
|
||||
newFileInfo.rootpath = less.rootpath || hrefParts.path;
|
||||
newFileInfo.rootFilename = href;
|
||||
|
||||
Reference in New Issue
Block a user