Skip to content

Commit

Permalink
feat: upgrade to fontaine v0.4 with size-adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jun 8, 2023
1 parent 07b38d6 commit bf90881
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 224 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Github Actions][github-actions-src]][github-actions-href]
[![Codecov][codecov-src]][codecov-href]

> Font metric override implementation for [Nuxt 3](https://v3.nuxtjs.org)
> Font metric fallback implementation for [Nuxt 3](https://v3.nuxtjs.org)
- [ Changelog](https://github.com/nuxt-modules/fontaine/blob/main/CHANGELOG.md)
- [▶️  Online playground](https://stackblitz.com/github/nuxt-modules/fontaine/tree/main/playground)
Expand All @@ -15,7 +15,7 @@
**⚠️ `@nuxtjs/fontaine` is under active development. ⚠️**

- 💪 Reduces CLS by using local font fallbacks with crafted font metrics.
- ✨ Generates font metrics and overrides automatically.
- ✨ Generates font metrics and fallbacks automatically.
- ⚡️ Pure CSS, zero runtime overhead.

On the playground project, enabling/disabling this module makes the following differences rendering `/`, with no customisation required:
Expand All @@ -27,7 +27,7 @@ On the playground project, enabling/disabling this module makes the following di

## What's next

For best performance, you will need to inline _all_ your CSS, not just the font-face override rules (which this module does automatically), or there will still be a layout shift when the stylesheet loads (which is why the number above is not zero).
For best performance, you will need to inline _all_ your CSS, not just the font-face fallback rules (which this module does automatically), or there will still be a layout shift when the stylesheet loads (which is why the number above is not zero).

[This PR](https://github.com/nuxt/framework/pull/7160) aims to bring that ability to Nuxt itself.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"dependencies": {
"@nuxt/kit": "^3.4.2",
"fontaine": "^0.2.3",
"fontaine": "^0.4.0",
"magic-string": "^0.30.0",
"pathe": "^1.0.0",
"ufo": "^1.0.0"
Expand Down
8 changes: 4 additions & 4 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ export default defineNuxtConfig({
{
family: 'Roboto',
fallbacks: ['Zapfino'],
overrideName: 'fallback-a',
fallbackName: 'fallback-a',
},
{
family: 'Roboto',
fallbacks: ['Impact'],
overrideName: 'fallback-b',
fallbackName: 'fallback-b',
},
{
family: 'Roboto',
fallbacks: ['Georgia'],
overrideName: 'fallback-c',
fallbackName: 'fallback-c',
},
{
family: 'Poppins',
fallbacks: ['Georgia'],
overrideName: 'fallback-poppins',
fallbackName: 'fallback-poppins',
src: 'poppins.ttf',
root: 'assets',
},
Expand Down

0 comments on commit bf90881

Please sign in to comment.