mirror of
https://github.com/less/less.js.git
synced 2026-01-22 21:58:14 -05:00
fix @import not working. Better error message for empty response
This commit is contained in:
@@ -286,12 +286,3 @@ function error(e, href) {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Used by `@import` directives
|
||||
//
|
||||
less.Parser.importer = function (path, paths, callback) {
|
||||
loadStyleSheet({ href: path, title: path }, function (root) {
|
||||
callback(root);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -927,5 +927,14 @@ less.Parser = function Parser(env) {
|
||||
};
|
||||
};
|
||||
|
||||
less.Parser.importer = null;
|
||||
if (typeof(window) !== 'undefined') {
|
||||
//
|
||||
// Used by `@import` directives
|
||||
//
|
||||
less.Parser.importer = function (path, paths, callback) {
|
||||
loadStyleSheet({ href: path, title: path }, function (root) {
|
||||
callback(root);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@ tree.Import = function (path, imports) {
|
||||
// Only pre-compile .less files
|
||||
if (! this.css) {
|
||||
imports.push(this.path, function (root) {
|
||||
if (! root) {
|
||||
throw new(Error)("Error parsing " + that.path);
|
||||
}
|
||||
that.root = root;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user