What's the T3 way to load a font from google fonts?
above, I have it in
_document.tsx
right now
17 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Use a custom css file with @font-face. That is the official way how browsers lazily load fonts. Also you can use that outside of next projects
https://google-webfonts-helper.herokuapp.com/fonts/jost?subsets=latin this tool automatically generates the css and font files for you
You will put these into your public dir and specify the href to the css file inside the link - „component“
I use the new @next/font thing
Should work for v12 too
I tried it with v12 it doesn’t work
npm i @next/font
import { Font } from “@next/font/google”
Works for meAlso don’t you need to use the app folder for it to work in 13
const font = Font()
Now use font.className in a class
NoInteresting
Why would you
It just gets a font
What file do you have it in?
No file just where I use it
_document?
Ah
GitHub
GitHub - barrybtw/next13-hero
Contribute to barrybtw/next13-hero development by creating an account on GitHub.
I used it here
Index page
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
👍 for what though lol
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View