New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Both woff2 and woff are downloaded in browser #14
Comments
I noticed this today via network inspection. One <link rel="preload"... but two @font-faces in the <style> for both the woff2 and woff. It looks like the @font-face text is coming from https://fonts.googleapis.com/css , like https://fonts.googleapis.com/css2?family=Open+Sans:wght@400&display=swap . (Huh, that API seems to ignore the "subset" arg...) Parsing the CSS, then "reducing"... that doesn't seem like it would introduce the extra woff. Preload in gatsby-ssr.js just takes formats[0] Hmm... maybe Google Fonts API is not even designed to consider this use case? Urg. How can this be fixed? I've hit my 1 hour timebox, I'm moving on. |
I'm seeing this, too. Both formats are loaded even though not needed. |
Is this what is causing this error?
I tried specifying only "woff" in formats, but then I get the same error without the 2.
|
After encountering this problem I switched to using Fontsource across all of my projects. Self-host Google Fonts with Fontsource (Gatsby docs) |
- hupe1980#14 - stops all included formats being downloaded unnecessarilly
Correct way to include fallback formats via @font-face is this according to MDN
@font-face {
font-family: "Open Sans";
src: url("/font.woff2") format("woff2"),
url("/font.woff") format("woff");
}
But this plugin does following:
@font-face {
font-family: "Open Sans";
src: url("/font.woff2") format("woff2")
}
@font-face {
font-family: "Open Sans";
src: url("/font.woff") format("woff")
}
which couses both formats to be downloaded.
The text was updated successfully, but these errors were encountered: