After running Google Lighthouse, I was directed to an article about how to optimize font loading speed:
https://developers.google.com/web/updates/2016/02/font-display
Previously, I was loading Open Sans like this:
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
The article provided a different example that I attempted to implement:
@font-face {
font-family: 'Open Sans';
font-display: block;
src: local('Open Sans'), url(https://fonts.googleapis.com/css?family=Open+Sans) format('woff2');
}
However, the new method did not work as expected. Can someone point out my mistake?
UPDATE: Issue resolved. It turns out I need to retain the font-family: "Open Sans"
, which I mistakenly believed was no longer necessary. Apologies for any confusion caused.