-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fonts best practice for loading fonts #10475
Fonts best practice for loading fonts #10475
Comments
Hi! 👋 You should import the fonts in your Layout component (the one that wraps all pages). Other than that you don't have to do anything else. You could also preload them (as seen here) but I personally don't see the need for that. Slightly unrelated note: |
Thanks @LekoArts! This is how I ended doing it in a dynamic way in gatsby-ssr.js. If anyone wants to turn it into a gatsby plugin, feel free.
|
You might be interested in my proposal here: #14281 |
What is the best way to load fonts in Gatsby? I currently just import the typeface into my component like this:
import "typeface-pacifico"
import "typeface-raleway"
import "typeface-open-sans"
I wonder if there is a better way, as i get Minimize Critical Requests Depth in Lighthouse.
The text was updated successfully, but these errors were encountered: