Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Support asyncronous functions in config.url and config.import.
  • Loading branch information
DavidArchibald committed Mar 20, 2021
commit b22e689863773461126e74f122d853e1173236bb
9 changes: 6 additions & 3 deletions src/plugins/postcss-import-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,12 @@ const plugin = (options = {}) => {
media = valueParser.stringify(mediaNodes).trim().toLowerCase();
}

if (options.filter && !options.filter(normalizedUrl, media)) {
// eslint-disable-next-line no-continue
continue;
if (options.filter) {
const processURL = await options.filter(normalizedUrl, media);
if (!processURL) {
// eslint-disable-next-line no-continue
continue;
}
}

node.remove();
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/postcss-url-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ const plugin = (options = {}) => {

normalizedUrl = normalizeUrl(normalizedUrl, isStringValue);

if (!options.filter(normalizedUrl)) {
const processUrl = await options.filter(normalizedUrl);
if (!processUrl) {
// eslint-disable-next-line no-continue
continue;
}
Expand Down