From 12969de390dc01cb3a91905fa771a78044f95644 Mon Sep 17 00:00:00 2001 From: Bass Jobsen Date: Mon, 19 Jan 2015 09:09:14 +0100 Subject: [PATCH] optional imports should fix https://github.com/less/less.js/issues/2145 --- lib/less/import-manager.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/less/import-manager.js b/lib/less/import-manager.js index d70c1605..386320aa 100644 --- a/lib/less/import-manager.js +++ b/lib/less/import-manager.js @@ -40,12 +40,14 @@ module.exports = function(environment) { importManager.queue.splice(importManager.queue.indexOf(path), 1); // Remove the path from the queue var importedEqualsRoot = fullPath === importManager.rootFilename; - + if (importOptions.optional && e) { + callback(null, {rules:[]}, false, null); + } + else { importManager.files[fullPath] = root; - if (e && !importManager.error) { importManager.error = e; } - callback(e, root, importedEqualsRoot, fullPath); + } }; var newFileInfo = {