ivodolenc/nuxt-font-loader

Plans on implementing Nuxt-fontaine?

StevenJPx2 opened this issue · 1 comments

Request Description

Nuxt Fontaine is a cool library that'll help with page load speeds by default by doing some magic with font metrics. It'll be cool if this library has it by default.

Alternative Solutions

None.

Additional Details

No response

Hi, thanks for the suggestion.

This module already uses methods for best performance when it comes to font loading.

The module automatically detects the configuration, depending on the strategy whether it is local or external, and adds preconnect and preload link tags in the head section with minified inline styles for the @font-face rules.

This is all done by the minimal footprint so there is no additional code bloat. The module has only one dependency (for styling console logs) which is also under 1kb.

I just did some quick tests and here are the results:

Screen Shot 2022-11-30 at 11 44 14

Screen Shot 2022-11-30 at 11 43 42

Test environment

  1. Default nuxt-app project
  2. nuxt-font-loader with the local strategy
// nuxt.config.ts

{
  modules: ['nuxt-font-loader'],

  fontLoader: {
    local: [
      {
        src: '/fonts/AspektaVF.woff2',
        family: 'Aspekta Variable',
        weight: '100 900'
      }
    ]
  }
}
  1. Run generate and preview commands

So, in terms of page load speed, that's pretty much it.

As for your suggestion, I don't plan to implement it right now, I want to keep the module simple.

But just out of curiosity, have you had any performance or page load issues with this module?