cssninjaStudio / unplugin-fonts

Universal Webfont loader - Unfonts - based on https://web.dev/optimize-webfont-loading/
MIT License
340 stars 24 forks source link

Support: How to deal with installed fonts such as fontsource/roboto #27

Closed JesalR closed 1 year ago

JesalR commented 2 years ago

Hi,

I'm using fontsource to bundle fonts alongside my website, but the fonts are loaded as font-face css blocks when the file is imported, and that leads to the fonts not being prefetched.

I wanted to use this package to deal with that and add prefetch directives for the fonts, however I'm unsure how to configure that.

I import '@fontsource/roboto at my React entrypoint, but that is too late for a Vite plugin to see the fonts.

Any suggestions on the pattern to tackle installed fonts?

stafyniaksacha commented 1 year ago

Hello @JesalR

This feature has been included in the v1.0.0

Here are the details: https://github.com/cssninjaStudio/unplugin-fonts#fontsource