When you use
font-display: swap;, which Google Fonts does when you use the default
&display=swap part of the URL , you’re already saying, “I’m cool with FOUT,” which is another way of saying web text is displayed right away, and when the web font is ready, “swap” to it.
There is already an async nature to what you are doing, so you might as well extend that async-ness to the rest of the font loading. Harry Roberts:
If you’re going to use
font-displayfor your Google Fonts then it makes sense to asynchronously load the whole request chain.
Harry’s recommended snippet:
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link rel="preload" as="style" href="$CSS&display=swap" /> <link rel="stylesheet" href="$CSS&display=swap" media="print" onload="this.media='all'" />
$CSS is the main part of the URL that Google Fonts gives you.
Looks like a ~20% render time savings with no change in how it looks/feels when loading. Other than that, it’s faster.
Will it work with material icons loading?