DEV Community

Discussion on: The best way to load and use Google Fonts in Next.js + Tailwind

Collapse
 
marcvangend profile image
Marc

Thanks for sharing. AFAIK, these is no pages/_document file by default, you have to create it yourself to override the default behavior.
But I'm wondering: is it really necessary here to start using a customized _document? You could also use next/head in pages/_app to add the code snippet to the head.

Collapse
 
thomasledoux1 profile image
Thomas Ledoux

Hey Marc,

I haven't tested this with pages/_app yet, but I assume it would work too since you would inject the code into the

section with next/head on every page.
Collapse
 
gabrielmlinassi profile image
Gabriel Linassi

There's an eslint rule that recommends to add it to the _document file. See nextjs.org/docs/messages/no-page-c...

Collapse
 
pabloverduzco profile image
Pablo Verduzco

I think it is totally allowed.

Check this out: npmjs.com/package/next-google-font...