NuxtN
Nuxt14mo ago
David

How do we use nuxt/fonts with local otf files ?

Hi guys! I have to use local font files in my nuxt project. I tried to make an configuration like this :
export default defineNuxtConfig({
  ...
  modules: [..., '@nuxt/fonts'],
  fonts: {
    local: {},
    defaults: {
      weights: [400, 500, 600, 700, 800],
      styles: ['normal', 'italic']
    }
  }
})


I have move all my necessary font files in /public/_fonts directory, but when I apply font on my element it doesn't work:
/public/_fonts/My Font.otf
font-family: 'My Font'
Was this page helpful?