Google Font Integration
When integrating google fonts; is it okay if I skip the first 2 lines and keep only the link tag containing css sources for my fonts to minimize my HTML code?
And I write:
as
2 Replies
Sure, you can ignore them. But it might cause your site to either load slower or to get a FOUT (flash of unstyled text).
The
rel="preconnect" attribute tells the browser to initiate an async connection to the href so when it's used later in the code the connection is already there and the resource can be loaded immediately.
https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preconnect
Then again, I'm a staunch believer in downloading and hosting the font yourself instead of using Google fonts. That way you control where/how the font is hosted, can reuse existing connections to your domain, and don't give Google any additional potential information on your users.Thanks!