fonts icon indicating copy to clipboard operation
fonts copied to clipboard

Strategy to use fonts installed as npm packages

Open fayazara opened this issue 1 year ago • 2 comments

So, there's fonts like Cal Sans and Geist, which are installed usually as packages and imported, what's the best way to use these?

fayazara avatar Apr 18 '24 19:04 fayazara

Is this what you are looking for?

export default defineNuxtConfig({
  css: [
    "@fontsource/roboto/100.css",
    "@fontsource/roboto/300.css",
    "@fontsource/roboto/400.css",
    "@fontsource/roboto/500.css",
    "@fontsource/roboto/700.css",
    "@fontsource/roboto/900.css",
  ],
})

oemer-aran avatar Jul 05 '24 09:07 oemer-aran

Is this what you are looking for?

export default defineNuxtConfig({
  css: [
    "@fontsource/roboto/100.css",
    "@fontsource/roboto/300.css",
    "@fontsource/roboto/400.css",
    "@fontsource/roboto/500.css",
    "@fontsource/roboto/700.css",
    "@fontsource/roboto/900.css",
  ],
})

While this works, I suppose that having an optional way to tell the 'local' provider to scan a set of subfolders or /node_modules instead of /public could help with FontSource and other npm served fonts, it'd also eliminate the need to specify each weight

frandmb avatar Jul 17 '24 05:07 frandmb