Skip to content

Commit 82b29de

Browse files
committed
Merge branch 'patch-8' of https://github.com/bassjobsen/less.js
2 parents 69d4d60 + 1aec38f commit 82b29de

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/less/import-manager.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@ module.exports = function(environment) {
4040
importManager.queue.splice(importManager.queue.indexOf(path), 1); // Remove the path from the queue
4141

4242
var importedEqualsRoot = fullPath === importManager.rootFilename;
43-
43+
if (importOptions.optional && e) {
44+
callback(null, {rules:[]}, false, null);
45+
}
46+
else {
4447
importManager.files[fullPath] = root;
45-
4648
if (e && !importManager.error) { importManager.error = e; }
47-
4849
callback(e, root, importedEqualsRoot, fullPath);
50+
}
4951
};
5052

5153
var newFileInfo = {

lib/less/parser/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ var Parser = function Parser(context, imports, fileInfo) {
11731173
},
11741174

11751175
importOption: function() {
1176-
var opt = parserInput.$re(/^(less|css|multiple|once|inline|reference)/);
1176+
var opt = parserInput.$re(/^(less|css|multiple|once|inline|reference|optional)/);
11771177
if (opt) {
11781178
return opt[1];
11791179
}

0 commit comments

Comments
 (0)