ソースを参照

fixed testing with empty URL

Gildas 7 年 前
コミット
102b7ac4ba
1 ファイル変更2 行追加2 行削除
  1. 2 2
      lib/single-file/css-fonts-alt-minifier.js

+ 2 - 2
lib/single-file/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:base64,["']?\)/;
 	const LOCAL_SOURCE = "local(";
 	const MEDIA_ALL = "all";
 	const FONT_WEIGHTS = {
@@ -187,7 +187,7 @@ this.fontsAltMinifier = this.fontsAltMinifier || (() => {
 	}
 
 	function processFontFaceRule(cssRule, fontInfo, stats) {
-		const findSource = fontFormat => fontInfo.find(source => source.src != EMPTY_URL_SOURCE && source.format == fontFormat);
+		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;
 		stats.fonts.discarded += fontInfo.length;