gatsby-plugin-webfonts
gatsby-plugin-webfonts copied to clipboard
Random /static/webfonts/l/font reference destroying the font loading.
As of a couple of days, a random:
@font-face{font-display:swap;font-family:Libre Franklin;font-style:normal;font-weight:400;src:url(/static/webfonts/l/font) format("woff"),url(/static/webfonts/l/font) format("woff"),url(/static/webfonts/l/font) format("woff")}
is added to the
After digging in, theres an added: https://fonts.gstatic.com/l/font?kit=blabla&skey=blabla&v=v40 font loaded. I guess Google Webfont changed stuff? This is now destroying the lowest font weight in production sites.
Okay I figured it out.
By default, woff2
and woff
are loaded. Apparently, woff
is starting to return the /l/font?kit...
urls, which mess up the logic of this codebase. I don't understand why the formatAgent stuff is needed, but https://github.com/hupe1980/gatsby-plugin-webfonts/blob/cdfc66530fa02e83c576b7bf722e219e229a0841/gatsby-plugin-webfonts/src/create-options.js#L10 makes the font return these urls. So I guess technically you could also change the formatAgent?
But I chose to now only load woff2
by setting formats: ['woff2']