Skip to content

Commit b8a2c38

Browse files
refactor: code
1 parent 3ecfc26 commit b8a2c38

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/plugins/postcss-url-parser.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ function visitor(result, parsedResults, node, key) {
3636
return;
3737
}
3838

39-
const value =
40-
typeof node.raws.value === "undefined" ? node[key] : node.raws.value.raw;
41-
const parsed = valueParser(value);
39+
const parsed = valueParser(
40+
typeof node.raws.value === "undefined" ? node[key] : node.raws.value.raw
41+
);
4242

4343
let needIgnore;
4444

@@ -109,16 +109,18 @@ function visitor(result, parsedResults, node, key) {
109109
// eslint-disable-next-line consistent-return
110110
return false;
111111
} else if (isImageSetFunc.test(valueNode.value)) {
112-
// TODO bug
113112
let imageSetWebpackIgnore = false;
114113

115114
for (const nNode of valueNode.nodes) {
116115
const { type, value } = nNode;
117116

118117
if (type === "comment") {
119-
if (webpackIgnoreCommentRegexp.test(value)) {
120-
imageSetWebpackIgnore = true;
118+
const matched = value.match(webpackIgnoreCommentRegexp);
119+
120+
if (matched) {
121+
imageSetWebpackIgnore = matched[2] === "true";
121122
}
123+
122124
// eslint-disable-next-line no-continue
123125
continue;
124126
}

0 commit comments

Comments
 (0)