Skip to content

Commit 5cc69b5

Browse files
authored
Fix incorrectly replacing only first alias in a multiline statement
This: `background-image: url('@app/public/img/cloud.svg'), url('@app/public/img/cloud.svg');` won't work with the current code as the regex is not lazy and it matching more than what it should match.
1 parent 0c4b35b commit 5cc69b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var namedRegexp = require('named-js-regexp');
55

66
module.exports = function (css, resourcePath, aliases) {
77
var IMPORT_REGEX = namedRegexp(/^(:<import>@import\s+)(:<url_tag_open>url\()?\s*(:<quote_open>"|')(:<url>.+)\s*(:<quote_close>"|')(:<url_tag_close>\))?(:<context>.*);$/gm);
8-
var URL_REGEX = namedRegexp(/(:<url_tag_open>url\()\s*(:<quote_open>"|')?(:<url>.+)\s*(:<quote_close>"|')?(:<url_tag_close>\))/gm);
8+
var URL_REGEX = namedRegexp(/(:<url_tag_open>url\()\s*(:<quote_open>"|')?(:<url>.+?)\s*(:<quote_close>"|')?(:<url_tag_close>\))/gm);
99
css = parse(css, IMPORT_REGEX);
1010
css = parse(css, URL_REGEX);
1111

0 commit comments

Comments
 (0)