Skip to content

Using local fonts with variable weight #779

@yannick-mir

Description

@yannick-mir

I'm trying to add local fonts with a variable weight but Nuxt cannot find the font face declaration.

Fonts are located here:
/public/fonts/Merriweather/Merriweather-400-700.ttf
/public/fonts/Satoshi/Satoshi-400-700.woff2

I tried naming them according to the docs, but it's still not working.

fonts: {
    families: [
      {
        preload: true,
        name: 'Merriweather',
        provider: 'local',
        weights: ['400 700'],
        styles: ['normal', 'italic'],
        subsets: ['latin'],
      },
      {
        preload: true,
        name: 'Satoshi',
        provider: 'local',
        weights: ['400 700'],
        styles: ['normal', 'italic'],
        subsets: ['latin'],
      },
    ],
    defaults: {
      preload: false,
      fallbacks: {
        'sans-serif': ['Arial'],
        'serif': ['Times New Roman'],
      },
    },
  },
 WARN  Could not produce font face declaration from local for font family Merriweather.

This was already asked here without response:
#178

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions