mirror of
https://github.com/less/less.js.git
synced 2026-02-05 12:35:14 -05:00
add hook for import error
This commit is contained in:
@@ -87,7 +87,7 @@ var less = {
|
||||
require('./tree/' + n);
|
||||
});
|
||||
|
||||
less.Parser.importer = function (file, paths, callback) {
|
||||
less.Parser.importer = function (file, paths, callback, env) {
|
||||
var pathname;
|
||||
|
||||
// TODO: Undo this at some point,
|
||||
@@ -116,7 +116,11 @@ less.Parser.importer = function (file, paths, callback) {
|
||||
});
|
||||
});
|
||||
} else {
|
||||
callback({ type: 'File', message: "'" + file + "' wasn't found.\n" });
|
||||
if (typeof(env.errback) === "function") {
|
||||
env.errback(file, paths, callback);
|
||||
} else {
|
||||
callback({ type: 'File', message: "'" + file + "' wasn't found.\n" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1269,7 +1269,13 @@ if (less.mode === 'browser' || less.mode === 'rhino') {
|
||||
// We pass `true` as 3rd argument, to force the reload of the import.
|
||||
// This is so we can get the syntax tree as opposed to just the CSS output,
|
||||
// as we need this to evaluate the current stylesheet.
|
||||
loadStyleSheet({ href: path, title: path, type: env.mime }, callback, true);
|
||||
loadStyleSheet({ href: path, title: path, type: env.mime }, function (e) {
|
||||
if (e && typeof(env.errback) === "function") {
|
||||
env.errback.call(null, path, paths, callback, env);
|
||||
} else {
|
||||
callback.apply(null, arguments);
|
||||
}
|
||||
}, true);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user