|
|
@@ -1486,7 +1486,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
}
|
|
|
|
|
|
static resolveStylesheetURLs(stylesheetContent, baseURI) {
|
|
|
- const urlFunctions = Util.getUrlFunctions(stylesheetContent);
|
|
|
+ const urlFunctions = Util.getUrlFunctions(stylesheetContent, true);
|
|
|
urlFunctions.map(urlFunction => {
|
|
|
const originalResourceURL = Util.matchURL(urlFunction);
|
|
|
const resourceURL = Util.normalizeURL(originalResourceURL);
|
|
|
@@ -1560,7 +1560,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
async function processFontFaceRule(ruleData) {
|
|
|
await Promise.all(ruleData.block.children.toArray().map(async declaration => {
|
|
|
if (declaration.type == "Declaration" && declaration.value.children) {
|
|
|
- const urlFunctions = Util.getUrlFunctions(Util.getCSSValue(declaration.value));
|
|
|
+ const urlFunctions = Util.getUrlFunctions(Util.getCSSValue(declaration.value), true);
|
|
|
await Promise.all(urlFunctions.map(async urlFunction => {
|
|
|
const originalResourceURL = Util.matchURL(urlFunction);
|
|
|
const resourceURL = Util.normalizeURL(originalResourceURL);
|
|
|
@@ -1859,8 +1859,13 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
return new RegExp(string.replace(REGEXP_ESCAPE, "\\$1"), "gi");
|
|
|
}
|
|
|
|
|
|
- static getUrlFunctions(stylesheetContent) {
|
|
|
- return Array.from(new Set(stylesheetContent.match(REGEXP_URL_FN) || []));
|
|
|
+ static getUrlFunctions(stylesheetContent, unique) {
|
|
|
+ const result = stylesheetContent.match(REGEXP_URL_FN) || [];
|
|
|
+ if (unique) {
|
|
|
+ return [...new Set(result)];
|
|
|
+ } else {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
static getImportFunctions(stylesheetContent) {
|