I'm using Gatsby.js and its Typography plugin with the Irving theme.
This theme requires the Google Fonts "Exo" and "Yrsa", and adds an import to the <head>
section of the exported static html files:
<link href="//fonts.googleapis.com/css?family=Exo:700|Yrsa:400,700" rel="stylesheet" type="text/css"/>
This import is render-blocking content and I'd prefer to avoid it if possible for both users and my Google PageSpeed Insights score.
I tried using gatsby-plugin-google-fonts and added the following to my gatsby-config.js:
{
resolve: `gatsby-plugin-google-fonts`,
options: {
fonts: [
`Exo\:700`,
`Yrsa\:400,700`,
],
}
},
However this just adds a second import call. Should I be placing them in the static directory? Even then, how can I configure Typography to still use these fonts without importing them separately?
display: none;
on the.wf-loading
class. This is a pretty simple solution, I guess I just wish Google Fonts had a similar capability. – DecemviromitGoogleFont
suggestion. I agree the webfontloader solution would be better. I am playing around with it and am able to import the script ingatsby-ssr.js
, however when I try to add another<script>
tag with configuration, it throws an error. I think it is related to this issue: github.com/gatsbyjs/gatsby/issues/3722 – Decemvir