Nextjs Font CSS Variable Collision

Fix CSS custom property name collision between next/font and design system variables in globals.css. Use when: (1) fonts look wrong despite correct next/font configuration — falling back to Georgia, system-ui, or other fallback fonts, (2) DevTools shows --font-display or --font-body resolving to literal font names like 'Instrument Serif' instead of hashed names like '__Instrument_Serif_315a98', (3) fonts break after adding/removing next/font imports (bundle reordering), (4) @font-face uses hashed names but CSS variables hold unhashed literal names. Covers next/font variable naming, CSS cascade specificity with :root, and webpack CSS chunk ordering.

hubeiqiao 512e13b 7.1 KB Updated

File contents

hubeiqiao/skills/tree/main/nextjs-font-css-variable-collision commit 512e13b1f2

Frequently asked questions

npx skillmds@latest add hubeiqiao/nextjs-font-css-variable-collision