diff --git a/lib/less/index.js b/lib/less/index.js index 657d9bd0..a74f4242 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -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" }); + } } } diff --git a/lib/less/parser.js b/lib/less/parser.js index 1d328d15..d7c5d420 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -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); }; }