Pārlūkot izejas kodu

test all values

Gildas 3 gadi atpakaļ
vecāks
revīzija
f5edf2b0fd
1 mainītis faili ar 10 papildinājumiem un 2 dzēšanām
  1. 10 2
      src/single-file/modules/css-fonts-minifier.js

+ 10 - 2
src/single-file/modules/css-fonts-minifier.js

@@ -86,6 +86,7 @@ function process(doc, stylesheets, styles, options) {
 	}
 	const variableFound = fontsInfo.used.find(fontNames => fontNames.find(fontName => fontName.startsWith("var(--")));
 	let unusedFonts, filteredUsedFonts;
+	// debugger;
 	if (variableFound) {
 		unusedFonts = [];
 	} else {
@@ -163,6 +164,10 @@ function filterUnusedFonts(cssRules, declaredFonts, unusedFonts, filteredUsedFon
 }
 
 function testUsedFont(ruleData, familyName, declaredFonts, filteredUsedFonts) {
+	if (familyName.includes("proxima nova condensed")) {
+		debugger
+	}
+
 	let test;
 	const optionalUsedFonts = filteredUsedFonts && filteredUsedFonts.get(familyName);
 	if (optionalUsedFonts && optionalUsedFonts.length) {
@@ -193,8 +198,11 @@ function testUsedFont(ruleData, familyName, declaredFonts, filteredUsedFonts) {
 }
 
 function testFontweight(fontWeight, usedFontWeights) {
-	fontWeight = fontWeight.split(/[ ,]/)[0];
-	return usedFontWeights.includes(helper.getFontWeight(helper.removeQuotes(fontWeight)));
+	let test;
+	for (const value of fontWeight.split(/[ ,]/)) {
+		test = test || usedFontWeights.includes(helper.getFontWeight(helper.removeQuotes(value)));
+	}
+	return test;
 }
 
 function getDeclarationValue(declarations, propertyName) {