|
@@ -68,13 +68,13 @@ this.singlefile.lib.modules.fontsMinifier = this.singlefile.lib.modules.fontsMin
|
|
|
workStyleElement.remove();
|
|
workStyleElement.remove();
|
|
|
docContent += doc.body.innerText;
|
|
docContent += doc.body.innerText;
|
|
|
if (getComputedStyle) {
|
|
if (getComputedStyle) {
|
|
|
- fontsInfo.used = fontsInfo.used.map(fontNames => fontNames.map(fontName => {
|
|
|
|
|
- const matchedVar = fontName.match(/^var\((--.*)\)$/);
|
|
|
|
|
|
|
+ fontsInfo.used = fontsInfo.used.map(fontNames => fontNames.map(familyName => {
|
|
|
|
|
+ const matchedVar = familyName.match(/^var\((--.*)\)$/);
|
|
|
if (matchedVar && matchedVar[1]) {
|
|
if (matchedVar && matchedVar[1]) {
|
|
|
- const computedFontName = getComputedStyle.call(window, options.doc.body).getPropertyValue(matchedVar[1]);
|
|
|
|
|
- return computedFontName || fontName;
|
|
|
|
|
|
|
+ const computedFamilyName = getComputedStyle.call(window, options.doc.body).getPropertyValue(matchedVar[1]);
|
|
|
|
|
+ return computedFamilyName || familyName;
|
|
|
}
|
|
}
|
|
|
- return fontName;
|
|
|
|
|
|
|
+ return familyName;
|
|
|
}));
|
|
}));
|
|
|
}
|
|
}
|
|
|
const variableFound = fontsInfo.used.find(fontNames => fontNames.find(fontName => fontName.startsWith("var(--")));
|
|
const variableFound = fontsInfo.used.find(fontNames => fontNames.find(fontName => fontName.startsWith("var(--")));
|