gatsby-plugin-webfonts icon indicating copy to clipboard operation
gatsby-plugin-webfonts copied to clipboard

Random /static/webfonts/l/font reference destroying the font loading.

Open laurenskling opened this issue 5 months ago • 1 comments

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.

laurenskling avatar Mar 18 '24 20:03 laurenskling

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']

laurenskling avatar Mar 18 '24 20:03 laurenskling