Explorar o código

fixed empty data URI test

Gildas %!s(int64=7) %!d(string=hai) anos
pai
achega
732abd5faf
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      lib/single-file/modules/css-fonts-alt-minifier.js

+ 5 - 1
lib/single-file/modules/css-fonts-alt-minifier.js

@@ -33,7 +33,7 @@ this.fontsAltMinifier = this.fontsAltMinifier || (() => {
 	const REGEXP_FONT_FORMAT = /\.([^.?#]+)((\?|#).*?)?$/;
 	const REGEXP_FONT_FORMAT_VALUE = /format\((.*?)\)\s*,?$/;
 	const REGEXP_FONT_SRC = /(.*?)\s*,?$/;
-	const EMPTY_URL_SOURCE = /^url\(["']?data:base64,["']?\)/;
+	const EMPTY_URL_SOURCE = /^url\(["']?data:[^,]*,["']?\)/;
 	const LOCAL_SOURCE = "local(";
 	const MEDIA_ALL = "all";
 	const FONT_WEIGHTS = {
@@ -78,6 +78,7 @@ this.fontsAltMinifier = this.fontsAltMinifier || (() => {
 			});
 			processFontDetails(fontsDetails);
 			sheetIndex = 0;
+			debugger
 			stylesheets.forEach(stylesheetInfo => {
 				const cssRules = stylesheetInfo.stylesheet.children;
 				const media = stylesheetInfo.mediaText;
@@ -190,6 +191,9 @@ this.fontsAltMinifier = this.fontsAltMinifier || (() => {
 	}
 
 	function processFontFaceRule(ruleData, fontInfo, stats) {
+		if (cssTree.generate(ruleData).includes("-bold")) {
+			debugger
+		}
 		const findSource = fontFormat => fontInfo.find(source => !source.src.match(EMPTY_URL_SOURCE) && source.format == fontFormat);
 		const filterSource = fontSource => fontInfo.filter(source => source == fontSource || source.src.startsWith(LOCAL_SOURCE));
 		stats.fonts.processed += fontInfo.length;