diff --git a/index.js b/index.js index 6d0f616f..a1405f88 100755 --- a/index.js +++ b/index.js @@ -109,11 +109,12 @@ function parseStyles(styles, options, cb, importedFiles, ignoredAtRules, media, */ function parseGlob(atRule, options, imports) { var globPattern = atRule.params.replace(/['"]/g, "").replace(/(?:url\(|\))/g, "") + var paths = options.path.concat(moduleDirectories) var files = [] var dir = options.source && options.source.input && options.source.input.file ? path.dirname(path.resolve(options.root, options.source.input.file)) : options.root - options.path.forEach(function(p) { + paths.forEach(function(p) { p = path.resolve(dir, p) var globbed = glob.sync(path.join(p, globPattern)) globbed.forEach(function(file) { diff --git a/test/fixtures/glob.css b/test/fixtures/glob.css index 019ab757..b8047be0 100644 --- a/test/fixtures/glob.css +++ b/test/fixtures/glob.css @@ -1 +1,2 @@ @import "./foobar*.css"; +@import "by-hand/*.css"; diff --git a/test/fixtures/glob.expected.css b/test/fixtures/glob.expected.css index 3c6dd4b1..f7815894 100644 --- a/test/fixtures/glob.expected.css +++ b/test/fixtures/glob.expected.css @@ -1,2 +1,3 @@ foobar{} foobarbaz{} +.byHand{} diff --git a/test/index.js b/test/index.js index 9a3d94c1..28683e78 100755 --- a/test/index.js +++ b/test/index.js @@ -37,6 +37,7 @@ test("@import", function(t) { compareFixtures(t, "ignore", "should ignore & adjust external import") compareFixtures(t, "glob", "should handle a glob pattern", { + root: __dirname, path: importsDir, glob: true })