Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Preload fonts #21

Open
ram-you opened this issue Dec 22, 2018 · 0 comments
Open

Preload fonts #21

ram-you opened this issue Dec 22, 2018 · 0 comments

Comments

@ram-you
Copy link

ram-you commented Dec 22, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant