FullHuman / postcss-purgecss

PostCSS plugin for purgecss

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Preload fonts

ram-you opened this issue · comments

Hi,
I have a problem with preload fonts in a nuxt project.
As result, I would like to have something like that :
<link rel="preload" href="/_nuxt/fonts/5b23eeb.woff2" as="font" type="font/woff2" crossorigin>

..from my nuxt.config.js:

....
  css: [
    '~assets/css/tailwind.css',
    '~assets/fonts/Ubuntu/index.css',
  ],
...
...
  render: {
    bundleRenderer: {
      shouldPreload: (file, type) => {
        if (type === 'font') return /.woff2/.test(file)
        return ['script', 'style'].includes(type)
      }
    }
  },
...

Can you help please? THANKS