|
@@ -37,7 +37,7 @@ this.fontsMinifier = this.fontsMinifier || (() => {
|
|
|
const REGEXP_FONT_FORMAT = /\.([^.?#]+)((\?|#).*?)?$/;
|
|
const REGEXP_FONT_FORMAT = /\.([^.?#]+)((\?|#).*?)?$/;
|
|
|
const REGEXP_FONT_FORMAT_VALUE = /format\((.*?)\)\s*,?$/;
|
|
const REGEXP_FONT_FORMAT_VALUE = /format\((.*?)\)\s*,?$/;
|
|
|
const REGEXP_FONT_SRC = /(.*?)\s*,?$/;
|
|
const REGEXP_FONT_SRC = /(.*?)\s*,?$/;
|
|
|
- const EMPTY_URL_SOURCE = "url(\"data:base64,\") format(\"woff\")";
|
|
|
|
|
|
|
+ const EMPTY_URL_SOURCE = "url(\"data:base64,\")";
|
|
|
const PSEUDO_ELEMENTS = ["::after", "::before", "::first-line", "::first-letter", ":before", ":after", ":first-line", ":first-letter", "::placeholder", "::selection", "::marker", "::cue", "::slotted", "::spelling-error", "::grammar-error"];
|
|
const PSEUDO_ELEMENTS = ["::after", "::before", "::first-line", "::first-letter", ":before", ":after", ":first-line", ":first-letter", "::placeholder", "::selection", "::marker", "::cue", "::slotted", "::spelling-error", "::grammar-error"];
|
|
|
const FONT_WEIGHTS = {
|
|
const FONT_WEIGHTS = {
|
|
|
normal: 400,
|
|
normal: 400,
|
|
@@ -192,7 +192,7 @@ this.fontsMinifier = this.fontsMinifier || (() => {
|
|
|
return stylesheetContent;
|
|
return stylesheetContent;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function processFontFaceRule(rule, fontInfo, stats) {
|
|
|
|
|
|
|
+ function processFontFaceRule(rule, fontInfo, stats) {
|
|
|
let fontSources = fontInfo.map(fontSource => {
|
|
let fontSources = fontInfo.map(fontSource => {
|
|
|
const fontFormatMatch = fontSource.match(REGEXP_FONT_FORMAT_VALUE);
|
|
const fontFormatMatch = fontSource.match(REGEXP_FONT_FORMAT_VALUE);
|
|
|
let fontFormat;
|
|
let fontFormat;
|
|
@@ -224,7 +224,7 @@ this.fontsMinifier = this.fontsMinifier || (() => {
|
|
|
}
|
|
}
|
|
|
return { src: fontSource.match(REGEXP_FONT_SRC)[1], format: fontFormat };
|
|
return { src: fontSource.match(REGEXP_FONT_SRC)[1], format: fontFormat };
|
|
|
});
|
|
});
|
|
|
- const fontTest = (fontSource, format) => fontSource.src != EMPTY_URL_SOURCE && fontSource.format == format;
|
|
|
|
|
|
|
+ const fontTest = (fontSource, format) => !fontSource.src.startsWith(EMPTY_URL_SOURCE) && fontSource.format == format;
|
|
|
let woffFontFound = fontSources.find(fontSource => fontTest(fontSource, "woff2-variations"));
|
|
let woffFontFound = fontSources.find(fontSource => fontTest(fontSource, "woff2-variations"));
|
|
|
if (!woffFontFound) {
|
|
if (!woffFontFound) {
|
|
|
woffFontFound = fontSources.find(fontSource => fontTest(fontSource, "woff2"));
|
|
woffFontFound = fontSources.find(fontSource => fontTest(fontSource, "woff2"));
|