Skip to content

Commit b22e689

Browse files
Support asyncronous functions in config.url and config.import.
1 parent e194e6b commit b22e689

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/plugins/postcss-import-parser.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,12 @@ const plugin = (options = {}) => {
157157
media = valueParser.stringify(mediaNodes).trim().toLowerCase();
158158
}
159159

160-
if (options.filter && !options.filter(normalizedUrl, media)) {
161-
// eslint-disable-next-line no-continue
162-
continue;
160+
if (options.filter) {
161+
const processURL = await options.filter(normalizedUrl, media);
162+
if (!processURL) {
163+
// eslint-disable-next-line no-continue
164+
continue;
165+
}
163166
}
164167

165168
node.remove();

src/plugins/postcss-url-parser.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ const plugin = (options = {}) => {
261261

262262
normalizedUrl = normalizeUrl(normalizedUrl, isStringValue);
263263

264-
if (!options.filter(normalizedUrl)) {
264+
const processUrl = await options.filter(normalizedUrl);
265+
if (!processUrl) {
265266
// eslint-disable-next-line no-continue
266267
continue;
267268
}

0 commit comments

Comments
 (0)