Jelajahi Sumber

prevent storing fonts into css custom properties

Gildas 7 tahun lalu
induk
melakukan
4b875f0040
1 mengubah file dengan 3 tambahan dan 3 penghapusan
  1. 3 3
      lib/single-file/single-file-core.js

+ 3 - 3
lib/single-file/single-file-core.js

@@ -1050,13 +1050,13 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 					} else if (cssRule.type == CSSRule.STYLE_RULE) {
 						rulesContent += processURLFunctions(cssRule.cssText);
 					} else {
-						rulesContent += processURLFunctions(cssRule.cssText);
+						rulesContent += processURLFunctions(cssRule.cssText, true);
 					}
 				});
 				return rulesContent;
 			}
 
-			function processURLFunctions(cssText) {
+			function processURLFunctions(cssText, preventGrouping) {
 				const urlFunctions = DomUtil.getUrlFunctions(cssText);
 				urlFunctions.forEach(urlFunction => {
 					const originalResourceURL = DomUtil.matchURL(urlFunction);
@@ -1064,7 +1064,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 					if (!DomUtil.testIgnoredPath(resourceURL)) {
 						if (DomUtil.testValidURL(resourceURL, baseURI) && cssText.includes(urlFunction)) {
 							const resourceInfo = resourceInfos.get(resourceURL);
-							if (options.groupDuplicateImages && resourceInfo.variableName) {
+							if (options.groupDuplicateImages && resourceInfo.variableName && !preventGrouping) {
 								cssText = cssText.replace(resourceInfo.regExpUrlFunction, resourceInfo.variableName);
 							} else {
 								cssText = cssText.replace(resourceInfo.regExpUrlFunction, urlFunction.replace(originalResourceURL, resourceInfo.dataURI));