feat-agency / vite-plugin-webfont-dl

⚡ Webfont Download Vite Plugin - Make your Vite site load faster
MIT License
302 stars 11 forks source link

Sveltekit support #38

Closed amr3k closed 1 year ago

amr3k commented 1 year ago

This plugin does not work with sveltekit!

Here's a stackblitz repro

Please run npm run build && npm run preview

0xb4lint commented 1 year ago

Unfortunately there's no support for transformIndexHtml Vite hook, which is essential for this plugin.

More info: https://github.com/sveltejs/kit/discussions/8269

Radiergummi commented 11 months ago

So, AFAICT, the transformIndexHtml hook is required to inject the style tag and parse the link tags, right? But if we configure the font link manually, and disable injectAsStyleTag there should be a way to import the fonts, no?

This issue probably shouldn't be closed yet.

Radiergummi commented 11 months ago

For anyone else ending up at this issue -- I spent way too long trying to hack Sveltekit support into the library, and finally ended up using Fontsource instead, which allows you to install Google fonts as npm packages. Until Sveltekit adds support for transformIndexHtml, this is probably your best bet.