Repository navigation
Releases
v1.2.1
v1.2.1 is the next patch release.
👉 Changelog
🔥 Performance
- scan each inlined stylesheet once when deduplicating font faces (#974)
🩹 Fixes
- pass global families to fontless for fallback injection (#985)
- report public urls for fonts in bundler-emitted css (#982)
- local: name emitted fonts by their file contents (#984)
- keep font cache when nuxt is loaded without bundling (#981)
- use
build:confignitro hook on nitro v3 (#971) - resolve inlined font face urls against runtime cdn url (#972)
- rename stylesheets when font faces change after hashing (#979)
📖 Documentation
- add migration guide from @nuxtjs/google-fonts (#965)
- change Introduction header from H1 to H2 (#961)
- move docs to nuxt.com/modules/fonts (#959)
📦 Build
- deps: bump the npm_and_yarn group across 1 directory with 3 updates (#975)
🏡 Chore
- correct link to basic playground (
373876d)
🤖 CI
- update agentscan config (
4b8a288) - replace agentscan action with the github app (
ce995a1) - notify nuxt/translations on docs pushes (
2de1876)
🎉 New Contributors
- Ciro Lo Sapio (@cirolosapio)
- Youri Wijnands (@iruoy)
- Dogan Teke (@lafllamme)
- dependabot[bot] (@dependabot[bot])
❤️ Contributors
- Daniel Roe (@danielroe)
- Ciro Lo Sapio (@cirolosapio)
- Youri Wijnands (@iruoy)
- Dogan Teke (@lafllamme)
- dependabot[bot] (@dependabot[bot])
- Sébastien Chopin (@atinux)
v1.2.0
v1.2.0 is the next minor release.
👉 Changelog
🚀 Enhancements
- preload fonts with route rules (#952)
🩹 Fixes
- preload glyph subsetted families (#951)
❤️ Contributors
- Daniel Roe (@danielroe)
v1.1.0
v1.0.2 is the next patch release.
👉 Changelog
🩹 Fixes
- merge dev route rule instead of replacing user rules (#950)
- register server variants for native nitro v3 support (#945)
❤️ Contributors
- Max (@onmax)
- Daniel Roe (@danielroe)
v1.0.1
v1.0.1 is the next patch release.
👉 Changelog
📦 Build
- prepare before prepack step (
e2777f9)
❤️ Contributors
- Daniel Roe (@danielroe)
v1.0.0
v1.0.0 is the first stable release of Nuxt Fonts.
Nuxt Fonts has been in production use for over a year, and the underlying stack it is built on has now stabilised: unifont, fontaine and fontless all reached v1 alongside this release.
unifontresolves font metadata from providersfontaineuses that metadata to cut layout shiftfontlessdoes the whole thing in Vite with zero config
… and of course, @nuxt/fonts wraps all three and wires them into Nuxt.
Most projects should be able to upgrade simply by bumping the version, but read on for full details...!
🚨 Breaking (or significant) changes
Font metadata is cached per project
Font metadata and downloaded font files are now cached in node_modules/.cache/nuxt/fonts/meta relative to your project root rather than to the directory you run Nuxt from. The first build after upgrading will re-resolve and re-download fonts.
You can now configure the location with the cache option, pass your own unstorage instance, or disable persistent caching with cache: false.
export default defineNuxtConfig({
fonts: {
cache: '.cache/fonts',
},
})Font failures fail production builds
throwOnError now defaults to true outside of dev mode. Rather than producing a build with a missing font, the build fails when a provider errors, when a font file cannot be downloaded after retries, or when you set provider on a family and that provider does not contain it.
A family that cannot be found by any provider still warns rather than failing, as does an unknown provider name, so fonts you declare yourself in CSS are unaffected.
export default defineNuxtConfig({
fonts: {
throwOnError: false,
},
})Family-level @font-face descriptors now apply to provider fonts
display and unicodeRange set on a family were previously only honoured for families you declared manually with src, and were silently dropped for fonts resolved from a provider. They now apply in both cases. Descriptors other than display, weight and style (such as stretch, featureSettings and variationSettings) are also no longer dropped from manually declared families.
If you set any of these options on a family and relied on them being ignored, your generated CSS will change. Setting unicodeRange on a family marks it as subsetted, so it is no longer preloaded by default; set preload explicitly if you still want a preload link for it.
Injected @font-face rules are minified with lightningcss
Generated @font-face declarations were previously minified with esbuild unless you had opted into css.lightningcss. They are now always minified with lightningcss, so the exact serialisation of the CSS we inject may differ (for example local(Font Name) rather than local("Font Name")). This is cosmetic, but it will show up in snapshot tests.
The default 400 700 weight range is applied
weights has always been documented as defaulting to ['400 700'], but the default was set on the wrong option and never reached the resolver, so families without an explicit weights resolved at weight 400 alone. The documented default now takes effect (#619).
A family you didn't set weights on will resolve a bold face as well as a regular one, so expect additional @font-face rules and an additional file downloaded per family. Text that silently fell back to a synthesised bold will now render in the real one.
export default defineNuxtConfig({
fonts: {
defaults: {
weights: [400],
},
},
})Fonts are served from /_nuxt/fonts in Vite builds
Production builds with the Vite builder now emit font files as Vite build assets under app.buildAssetsDir, so they are served from /_nuxt/fonts/<hash>.woff2 rather than /_fonts/<hash>.woff2. Vite owns their URLs, which means app.cdnURL, a relative app.baseURL and experimental.renderBuiltUrl all now apply to fonts as they do to every other built asset.
The location of a font file is an implementation detail rather than a stable URL contract. If you have hard-coded /_fonts/ anywhere (a CDN rule, a CSP directive, a cache header, a test), point it at your build assets directory instead. Fonts are still served from /_fonts in development and with the webpack and rspack builders.
app.cdnURL now applies to fonts
This follows from the change above. cdnURL was previously never applied to font URLs, so fonts were always served same-origin. They now come from your CDN.
Important
Browsers always fetch fonts in CORS mode, so the CDN must respond with an Access-Control-Allow-Origin header that covers your site. Without it, fonts that previously loaded fail silently and the browser falls back to the next family in the stack. If you set cdnURL and don't control the headers on it, check this before upgrading.
assets.prefix is relative to buildAssetsDir in Vite builds
assets.prefix now names a directory inside app.buildAssetsDir in Vite production builds, and defaults to fonts. Setting prefix: '/my-fonts' serves fonts from /_nuxt/my-fonts rather than from /my-fonts. It remains a public path in development and with the webpack and rspack builders.
global: true families get font fallback metrics
global is the escape hatch for fonts we can't detect from your CSS, but until now that meant the fonts most likely to cause layout shift were the ones we did least about: the @font-face went into a global stylesheet and no fallback metric overrides were generated at all.
We now generate those overrides at every usage site we can see, so font-family: 'Anton' in a component becomes font-family: 'Anton', 'Anton Fallback: Arial', ... with the matching size-adjust and ascent-override rules alongside it, exactly as it would for a family that wasn't declared globally. The @font-face rule itself still comes from the global stylesheet and isn't duplicated, and preload hints are unchanged. Usage we can't scan (an SVG, a family chosen at runtime) keeps working as before.
Set fallbacks: [] on the family if you don't want the fallback rules.
The local provider only scans layer public/ directories
The local provider previously scanned every directory in nitro.publicAssets, including those that modules register for their own files. It now scans only the public/ directory of your project and of each layer.
If you relied on fonts in another nitro.publicAssets directory, add it to local.dirs:
export default defineNuxtConfig({
fonts: {
local: {
dirs: ['../some-module/fonts'],
},
},
})⚠️ Deprecations
experimental.processCSSVariables
fonts.experimental.processCSSVariables has moved to fonts.processCSSVariables. The old location still works and now warns.
export default defineNuxtConfig({
fonts: {
processCSSVariables: true,
},
})fonts:public-asset-context
Use fonts:resolved instead. It reports each family as it is resolved, with the URL every font file is served from and a readFont() to read its contents, so there's no need to reconstruct paths from the asset context. (The old hook still works.)
✨ Features
A new DevTools panel
The Fonts panel in Nuxt DevTools has been rebuilt on fontless. It lists every family resolved for your app, the provider that served it, the faces generated for it, where each one is used, and any warnings raised while resolving it.
nuxt-fonts-devtools.mp4
webpack and rspack support
Nuxt Fonts now works with the webpack and rspack builders. Previously our CSS transform ran after css-loader had already turned stylesheets into JavaScript modules, so no @font-face rule was ever injected, and a family declared with global: true failed the client build outright.
The transform now runs immediately before css-loader, which means it sees your styles after Sass and PostCSS have run, so a family named only through a preprocessor variable is detected too. There's nothing to change on your side, but a build that silently shipped no web fonts will now download them and serve them from /_fonts.
Arbitrary variable axes
Variable font axes beyond wght now resolve from providers that publish them, so you can ask for wdth, slnt, opsz and more.
export default defineNuxtConfig({
fonts: {
families: [
{
name: 'Roboto Flex',
provider: 'google',
providerOptions: {
google: {
experimental: {
variableAxis: { wdth: [['75', '100']] },
},
},
},
},
],
},
})Subsetting fonts to the glyphs you use
The new glyphs option reduces every font file we emit to the characters needed to render the text you give it, which can dramatically cut the bytes shipped for icon fonts and single-language sites.
export default defineNuxtConfig({
fonts: {
defaults: {
glyphs: 'Handgloves & 0123',
},
},
})Where a provider can subset server-side the characters are passed through to it, so the full file is never downloaded. Every other file is subsetted after download,...
v0.14.0
0.14.0 is the next minor release.
🚨 Breaking changes
Default font format is now woff2 only
Font providers previously returned multiple formats (woff2, woff, truetype, etc.). The default behavior now only resolves woff2 fonts, which is supported by all modern browsers.
Your @font-face declarations will typically have fewer src entries, reducing CSS size. In most cases this is a transparent improvement.
To restore the previous behavior or add additional formats:
export default defineNuxtConfig({
fonts: {
defaults: {
formats: ['woff2', 'woff', 'ttf'],
},
},
})Available values: 'woff2', 'woff', 'ttf', 'otf', 'eot'.
Cache invalidation
Font metadata caches are now isolated per provider and per provider options. After upgrading, your font metadata cache (node_modules/.cache/nuxt/fonts/) will be invalidated and fonts will be re-fetched on the next build. This is a one-time occurrence.
✨ Features
Resolve fonts from node_modules
A new built-in npm provider can resolve fonts installed as npm packages. If no other provider matches a font family, @nuxt/fonts will now attempt to find it in your node_modules via CDN metadata.
export default defineNuxtConfig({
fonts: {
npm: {
// options for the npm provider (optional)
},
},
})Font format resolution
You can control which font formats are resolved via the new defaults.formats option:
export default defineNuxtConfig({
fonts: {
defaults: {
formats: ['woff2'], // default
},
},
})Provider-specific font family options
You can now pass provider-specific options when configuring individual font families:
export default defineNuxtConfig({
fonts: {
families: [
{
name: 'My Font',
provider: 'google',
providerOptions: {
google: {
// provider-specific options for this family
},
},
},
],
},
})throwOnError option
Configure whether font resolution errors should throw or warn:
export default defineNuxtConfig({
fonts: {
throwOnError: true, // default: false
},
})lightningcss support
If your Nuxt project uses Vite's lightningcss mode for CSS processing (for example, if you're using rolldown-vite!), injected @font-face declarations are now minified with lightningcss instead of esbuild.
🩹 Fixes
- Prevent font flashes in development — The dev font proxy now returns
Cache-Control: public, max-age=31536000, immutableheaders, preventing font flashes during HMR on SSR frameworks. - Broader CSS file matching — Font family injection now matches additional CSS-like file patterns (Vue SFC
&lang.cssquery strings and inline style IDs), aligning with fontless behavior. - Adobe provider race condition — Fixed a race condition in the Adobe (Typekit) provider where concurrent font resolution could clear the font family map mid-flight, causing Adobe fonts to silently fail. (fix in unifont 0.7.4)
- Prioritize sliced woff2 over full ttf — When both formats are available, woff2 subsets are now correctly prioritized over full ttf files. (fix in unifont 0.7.2)
- Bunny provider subset filtering — The Bunny font provider now correctly filters by subsets. (fix in unifont 0.7.0)
👉 Changelog
🚀 Enhancements
- Upgrade to the latest versions fontless + unifont (3d634b0)
- Support lightningcss transforms (171c9a4)
- Add support for resolving fonts from local
node_modules(#781)
🩹 Fixes
- Prevent font flashes in development (0ec437e)
- Include more css-ish files when injecting font-families (6e8e343)
- deps: Bump unifont + reenable adobe tests (9d7715d)
📖 Documentation
- Add nuxt.care health badge (8f0a978)
🏡 Chore
✅ Tests
- Update snapshots for adobe preloads (035091a)
🤖 CI
- Pin github actions to full-length commit shas (18e3ff7)
❤️ Contributors
- Daniel Roe (@danielroe)
- Bjorn Lu (@bluwy)
v0.13.0
👉 Changelog
🚀 Enhancements
- Add
fonts:public-asset-contexthook (#758)
🩹 Fixes
- Use
$fetchfor proxy support when downloading fonts (#732)
📖 Documentation
- Fix Nuxt badge icon (#742)
🏡 Chore
- Update pnpm to 10.21 and enable trust policy (7b25049)
- Revert pnpm trust policy and restore provenance action (6d16adb)
- Include .nuxt types + migrate to ts projects (2daad4e)
🤖 CI
- Use new dependency review shared workflow (635bc79)
- Use correct var (25b8fa1)
- Try pinning to a commit hash (f40c07c)
- Pass base-ref + head-ref to reusable workflow (e8ffe84)
- Update name + hash (8d1165b)
- Simplify (08b8fcb)
❤️ Contributors
- Daniel Roe (@danielroe)
- Harlan Wilton (@harlan-zw)
- IO-Fire (@IO-Fire)
- Luke Nelson (@luc122c)
v0.12.1
v0.12.0
0.12.0 is the next major release.
👀 Highlights
There are a few breaking changes here, including major upgrades in unifont, fontaine + moving to a new fontless abstraction, setting default font weight, and more.
A visual check on upgrade is important - and let me know if you encounter any issues.
👉 Changelog
🔥 Performance
- Implement plugin hook filter (#683)
- Use code filter when
processCSSVariablesis disabled (509adfd) - Initialise providers in parallel with nuxt setup (#688)
🩹 Fixes
💅 Refactors
- Extract core utilities in preparation for
fontless(#627) - Use new
fontlesspackage (#645) - Use
extendViteConfigto set up devtools (05212ff)
📖 Documentation
- Add callout for variable font weight (#635)
- Add Installation section (#677)
- Refactor using docus (#679)
- Add warning note about font-family in template (78bbb42)
- Upgrade to docus v5 (#697)
🏡 Chore
- Prefer
nuxtovernuxi(#643) - Update tailwind separately (4bbca61)
- Pin
@types/node(cbc4215) - Prefer
nuxttonuxi(68f0ea9) - Prefer nuxt over nuxi (dea205c)
- deps-dev: Bump vite from 7.1.9 to 7.1.11 in the npm_and_yarn group across 1 directory (#710)
✅ Tests
- Allow for global font to be inlined in v4+ (934c71c)
- Inline global styles for test suite (56d8f51)
- Add test for css variable processing (#719)
🤖 CI
- Remove forced corepack installation (6b1c7bf)
- Bump to lts node versions (5a43a2d)
- Do not fail fast in matrix (ff92f48)
- Run tests on node 20 (873beb4)
- Use npm trusted publishing (db9e7d7)
- Always publish via pkg-pr-new (6f07c42)
- Add provenance action to check for downgrades in provenance (22dce94)
⚠️ Breaking Changes
❤️ Contributors
- Daniel Roe (@danielroe)
- Alexandru Teodor (@alexieremia)
- dependabot[bot] (@dependabot[bot])
- Baptiste Leproux (@larbish)
- Tom Tang (@qwerzl)
- Chad Adams (@cadamsdev)
v0.11.4
0.11.4 is a hotfix release to address a breaking change with variable fonts
👉 Changelog
🩹 Fixes
- deps: Revert
unifontupgrade (76a8f0d)
❤️ Contributors
- Daniel Roe (@danielroe)