diff --git a/Gruntfile.js b/Gruntfile.js index c1980ee58..9af870a6b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -291,6 +291,7 @@ module.exports = function (grunt) { 'test/less/*.less', // Don't test NPM import, obviously '!test/less/plugin-module.less', + '!test/less/import-module.less', '!test/less/javascript.less', '!test/less/urls.less', '!test/less/empty.less' diff --git a/lib/less-node/file-manager.js b/lib/less-node/file-manager.js index afe556323..542347c98 100644 --- a/lib/less-node/file-manager.js +++ b/lib/less-node/file-manager.js @@ -82,9 +82,8 @@ FileManager.prototype.loadFile = function(filename, currentDirectory, options, e } catch (e) {} } - else { - fullFilename = options.ext ? self.tryAppendExtension(fullFilename, options.ext) : fullFilename; - } + + fullFilename = options.ext ? self.tryAppendExtension(fullFilename, options.ext) : fullFilename; if (self.files[fullFilename]) { fulfill({ contents: self.files[fullFilename], filename: fullFilename}); diff --git a/package.json b/package.json index 7842a2723..fe705d7c8 100644 --- a/package.json +++ b/package.json @@ -61,12 +61,13 @@ "grunt-eslint": "^19.0.0", "grunt-saucelabs": "^9.0.0", "grunt-shell": "^1.3.0", + "import-module": "file:test/import-module", "jit-grunt": "^0.10.0", "less-plugin-clean-css": "^1.5.1", "performance-now": "^0.2.0", "phantomjs-prebuilt": "^2.1.7", - "promise": "^7.1.1", "phin": "^2.2.3", + "promise": "^7.1.1", "time-grunt": "^1.3.0" }, "keywords": [ diff --git a/test/css/import-module.css b/test/css/import-module.css new file mode 100644 index 000000000..c25cc8568 --- /dev/null +++ b/test/css/import-module.css @@ -0,0 +1,9 @@ +.three { + color: green; +} +.two { + color: blue; +} +.one { + color: red; +} diff --git a/test/import-module/one/1.less b/test/import-module/one/1.less new file mode 100644 index 000000000..7ee3e9d37 --- /dev/null +++ b/test/import-module/one/1.less @@ -0,0 +1,3 @@ +.one { + color: red; +} diff --git a/test/import-module/one/two/2.less b/test/import-module/one/two/2.less new file mode 100644 index 000000000..68036dbc5 --- /dev/null +++ b/test/import-module/one/two/2.less @@ -0,0 +1,3 @@ +.two { + color: blue; +} diff --git a/test/import-module/one/two/three/3.less b/test/import-module/one/two/three/3.less new file mode 100644 index 000000000..24cab7239 --- /dev/null +++ b/test/import-module/one/two/three/3.less @@ -0,0 +1,3 @@ +.three { + color: green; +} diff --git a/test/import-module/package.json b/test/import-module/package.json new file mode 100644 index 000000000..54adf9d4e --- /dev/null +++ b/test/import-module/package.json @@ -0,0 +1,11 @@ +{ + "name": "import-module", + "version": "1.0.0", + "description": "Less files to be included in node_modules directory for testing import from node_modules", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Rob Huzzey ", + "license": "ISC" +} diff --git a/test/less/import-module.less b/test/less/import-module.less new file mode 100644 index 000000000..37dcf6674 --- /dev/null +++ b/test/less/import-module.less @@ -0,0 +1,3 @@ +@import "import-module/one/two/three/3.less"; +@import "import-module/one/two/2"; +@import "import-module/one/1.less";