unplugin-fonts icon indicating copy to clipboard operation
unplugin-fonts copied to clipboard

[Bug]: Vite GoogleFonts injectTo not working when defer: true

Open chunlampang opened this issue 1 year ago • 1 comments

Demo URL

No response

What happened?

When defer is true, the tag injected to the html is always head-prepend.

Reproduction steps

import Unfonts from 'unplugin-fonts/vite'

Unfonts({
  google: {
    injectTo: 'head',
    display: 'swap',
    families: [
      { name: 'Inter', styles: 'wght@100;300;400;500;700;900' },
    ],
  },
})

Relevant log output

No response

What browsers are you seeing the problem on?

No response

What is your operating system?

Windows

chunlampang avatar Sep 13 '24 02:09 chunlampang

injectTo is missing here https://github.com/cssninjaStudio/unplugin-fonts/blob/a7e66d594e2c7e0a2cccfed7c15a069ffebb96c1/src/loaders/google-fonts.ts#L81-L89

chunlampang avatar Sep 13 '24 02:09 chunlampang

Merged

chunlampang avatar Dec 04 '24 02:12 chunlampang