Skip to content

Commit

Permalink
fix(webpack): correctly handle paranthesis in PostCSS in url
Browse files Browse the repository at this point in the history
  • Loading branch information
danr-za committed Feb 20, 2024
1 parent 003b961 commit 33a3ba1
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -152,7 +152,7 @@ export function PostcssCliResources(options: PostcssCliResourcesOptions) {
return Promise.all(
urlDeclarations.map(async (decl) => {
const value = decl.value;
const urlRegex = /url(?:\(\s*['"]?)(.*?)(?:['"]?\s*\))/g;
const urlRegex = /url(?:\(\s*(['"]?))(.*?)(?:\1\s*\))/g;
const segments: string[] = [];
let match;
let lastIndex = 0;
Expand All @@ -162,7 +162,7 @@ export function PostcssCliResources(options: PostcssCliResourcesOptions) {
const context =
(inputFile && path.dirname(inputFile)) || loader.context;
while ((match = urlRegex.exec(value))) {
const originalUrl = match[1];
const originalUrl = match[2];
let processedUrl;
try {
processedUrl = await process(originalUrl, context, resourceCache);
Expand Down

0 comments on commit 33a3ba1

Please sign in to comment.