Menu

1 / 2

Three font files preload on every page of our site, and on five of the six I measured one of them has nothing to render

DEV Community: nextjs·Daniel Pertu·about 17 hours ago
#q7dayA0V
#devtonextjs#devto#dev#font#fullscreen
Reading 0:00
15s threshold

CogniPrep's root layout loads three font families, from two different mechanisms:

import { GeistSans } from ' geist/font/sans ' ; import { GeistMono } from ' geist/font/mono ' ; import { Space_Grotesk } from ' next/font/google ' ;

const spaceGrotesk = Space_Grotesk ({ subsets : [ ' latin ' ], variable : ' --font-space-grotesk ' , display : ' swap ' , preload : true , // Preload to prevent font flash in header adjustFontFallback : true , });

Enter fullscreen mode

Exit fullscreen mode

All three variable classes go on <html> :

< html className = { ` ${ GeistSans . variable } ${ GeistMono . variable } ${ spaceGrotesk .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.