mirror of
https://github.com/less/less.js.git
synced 2026-01-23 06:07:56 -05:00
use structure to run variable imports last
This commit is contained in:
@@ -40,11 +40,12 @@ ImportVisitor.prototype = {
|
||||
var context = new contexts.Eval(this.context, this.context.frames.slice(0));
|
||||
var importParent = context.frames[0];
|
||||
|
||||
// TODO - process this type of imports *last*
|
||||
//if (importNode.isVariableImport()) {
|
||||
// console.log("variable import detected");
|
||||
//}
|
||||
importNode = this.processImportNode(importNode, context, importParent);
|
||||
this.importCount++;
|
||||
if (importNode.isVariableImport()) {
|
||||
this._sequencer.addVariableImport(this.processImportNode.bind(this, importNode, context, importParent));
|
||||
} else {
|
||||
importNode = this.processImportNode(importNode, context, importParent);
|
||||
}
|
||||
}
|
||||
visitArgs.visitDeeper = false;
|
||||
return importNode;
|
||||
@@ -64,7 +65,6 @@ ImportVisitor.prototype = {
|
||||
}
|
||||
|
||||
if (evaldImportNode && (!evaldImportNode.css || inlineCSS)) {
|
||||
this.importCount++;
|
||||
|
||||
if (evaldImportNode.options.multiple) {
|
||||
context.importMultiple = true;
|
||||
@@ -85,12 +85,17 @@ ImportVisitor.prototype = {
|
||||
}
|
||||
}
|
||||
importNode = evaldImportNode;
|
||||
} else {
|
||||
this.importCount--;
|
||||
}
|
||||
return importNode;
|
||||
},
|
||||
onImported: function (importNode, context, e, root, importedAtRoot, fullPath) {
|
||||
if (e && !e.filename) {
|
||||
e.index = importNode.index; e.filename = importNode.currentFileInfo.filename;
|
||||
if (e) {
|
||||
if (!e.filename) {
|
||||
e.index = importNode.index; e.filename = importNode.currentFileInfo.filename;
|
||||
}
|
||||
this.error = e;
|
||||
}
|
||||
|
||||
var importVisitor = this,
|
||||
@@ -111,20 +116,6 @@ ImportVisitor.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
var subFinish = function(e) {
|
||||
importVisitor.importCount--;
|
||||
|
||||
if (importVisitor.isFinished) {
|
||||
this._sequencer.tryRun();
|
||||
if (importVisitor.importCount === 0) {
|
||||
importVisitor._finish(e || importVisitor.error);
|
||||
}
|
||||
}
|
||||
if (e) {
|
||||
importVisitor.error = e;
|
||||
}
|
||||
};
|
||||
|
||||
if (root) {
|
||||
importNode.root = root;
|
||||
importNode.importedFilename = fullPath;
|
||||
@@ -143,7 +134,14 @@ ImportVisitor.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
subFinish();
|
||||
importVisitor.importCount--;
|
||||
|
||||
if (importVisitor.isFinished) {
|
||||
this._sequencer.tryRun();
|
||||
if (importVisitor.importCount === 0) {
|
||||
importVisitor._finish(importVisitor.error);
|
||||
}
|
||||
}
|
||||
},
|
||||
visitRule: function (ruleNode, visitArgs) {
|
||||
visitArgs.visitDeeper = false;
|
||||
|
||||
Reference in New Issue
Block a user