|
|
@@ -1027,10 +1027,9 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
urlFunction = "url(" + JSON.stringify(resourceURL) + ")";
|
|
|
const regExpUrlFunction = DomUtil.getRegExp(urlFunction);
|
|
|
if (duplicate && options.groupDuplicateImages) {
|
|
|
- resourceInfos.set(resourceURL, { regExpUrlFunction, dataURI: content, variableName: "var(" + SINGLE_FILE_VARIABLE_NAME_PREFIX + indexResource + ")" });
|
|
|
- DomUtil.insertVariable(doc, indexResource, content, options);
|
|
|
+ resourceInfos.set(resourceURL, { regExpUrlFunction, indexResource, dataURI: content, variableName: "var(" + SINGLE_FILE_VARIABLE_NAME_PREFIX + indexResource + ")" });
|
|
|
} else {
|
|
|
- resourceInfos.set(resourceURL, { regExpUrlFunction, dataURI: content });
|
|
|
+ resourceInfos.set(resourceURL, { regExpUrlFunction, indexResource, dataURI: content });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1050,6 +1049,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
} else if (cssRule.type == CSSRule.STYLE_RULE) {
|
|
|
rulesContent += processURLFunctions(cssRule.cssText);
|
|
|
} else {
|
|
|
+
|
|
|
rulesContent += processURLFunctions(cssRule.cssText, true);
|
|
|
}
|
|
|
});
|
|
|
@@ -1066,6 +1066,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
const resourceInfo = resourceInfos.get(resourceURL);
|
|
|
if (options.groupDuplicateImages && resourceInfo.variableName && !preventGrouping) {
|
|
|
cssText = cssText.replace(resourceInfo.regExpUrlFunction, resourceInfo.variableName);
|
|
|
+ DomUtil.insertVariable(doc, resourceInfo.indexResource, resourceInfo.dataURI, options);
|
|
|
} else {
|
|
|
cssText = cssText.replace(resourceInfo.regExpUrlFunction, urlFunction.replace(originalResourceURL, resourceInfo.dataURI));
|
|
|
}
|