Skip to content

Commit

Permalink
Fix css incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow committed Oct 30, 2020
1 parent e2fbe7d commit 99508d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ class CSS {
return data || '';
};

style = style.replace(/\(['|"]/gm, '(').replace(/['|"]\)/gm, ')');
const regexp = /(?<=url\().*?(?=\))/gm;
const matches = style.matchAll(regexp);

const rules = new Map();
for (const m of matches) {
if (m !== null && m.length > 0) {
const resourceURL = m[0];
let resourceURL = m[0];
if (resourceURL.startsWith('data:')) {
continue;
}
resourceURL = resourceURL.replace(/['|"]/g, '').replace(/['|"]/g, '');
const data = await convert(resourceURL, baseURL);
rules.set(resourceURL, Buffer.from(data).toString());
}
Expand Down

0 comments on commit 99508d0

Please sign in to comment.