Skip to content

Commit c178529

Browse files
committed
Ensure glob works when using single quotes and/or url(path)
1 parent 84fb978 commit c178529

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function parseStyles(styles, options, cb, importedFiles, ignoredAtRules, media,
108108
* @param {Array} imports
109109
*/
110110
function parseGlob(atRule, options, imports) {
111-
var globPattern = atRule.params.replace(/"/g, "")
111+
var globPattern = atRule.params.replace(/['"]/g, "").replace(/(?:url\(|\))/g, "")
112112
var files = []
113113
var dir = options.source && options.source.input && options.source.input.file ?
114114
path.dirname(path.resolve(options.root, options.source.input.file)) :

test/fixtures/glob-alt.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import url('./foobar*.css');
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
foobar{}
2+
foobarbaz{}

test/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ test("@import", function(t) {
4141
glob: true
4242
})
4343

44+
compareFixtures(t, "glob-alt", "should handle a glob pattern with single quote and/or url(...)", {
45+
path: importsDir,
46+
glob: true
47+
})
4448
compareFixtures(t, "recursive", "should import stylsheets recursively")
4549

4650
compareFixtures(t, "relative", "should import stylsheets relatively")

0 commit comments

Comments
 (0)