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

Poppins 500 not downloading

Open bloomlive opened this issue 3 years ago • 5 comments

Nuxt 3 RC 6 + google-fonts 3.0.0-0

googleFonts: { families: { Poppins: { wght: [300, 400, 500, 600, 700], }, }, display: 'swap', prefetch: true, preconnect: false, download: true, base64: false, useStylesheet: false, },

Poppins is not downloaded in specified weights, missing 500.

bloomlive avatar Aug 18 '22 08:08 bloomlive

Same for Montserrat, it ignores all weights and injects only 400.

asmeeee avatar Aug 19 '22 12:08 asmeeee

I'm having the same issue with Roboto. Is injecting only 400.

fnavarijo avatar Aug 23 '22 18:08 fnavarijo

I think I've found what is happening. The library depends on google-fonts-helper. This helps with the download of the fonts. When the execute method is called, it verifies that the .cache/nuxt-google-fonts exists. In case that it does, it returns (ref)

  // google-fonts-helpers
  if (!overwriting && fsExtra.pathExistsSync(cssPath)) {
      return;
    }

I was able to update my fonts adding the overwriting flag

// nuxt.config.js

export default defineNuxtConfig({
  modules: ['@nuxtjs/tailwindcss', '@nuxtjs/google-fonts'],
  googleFonts: {
    families: {
      Roboto: [100, 300],
      Lato: [100, 300, 500]
    },
    overwriting: true // this flag
  }
})

The downside, is that everytime your server restarts, will fetch the fonts again.

The other quick solution is removing node_modules/.cache/nuxt-google-fonts and starting the server again :smile:

fnavarijo avatar Aug 23 '22 20:08 fnavarijo

I think I've found what is happening. The library depends on google-fonts-helper. This helps with the download of the fonts. When the execute method is called, it verifies that the .cache/nuxt-google-fonts exists. In case that it does, it returns (ref)

  // google-fonts-helpers
  if (!overwriting && fsExtra.pathExistsSync(cssPath)) {
      return;
    }

I was able to update my fonts adding the overwriting flag

// nuxt.config.js

export default defineNuxtConfig({
  modules: ['@nuxtjs/tailwindcss', '@nuxtjs/google-fonts'],
  googleFonts: {
    families: {
      Roboto: [100, 300],
      Lato: [100, 300, 500]
    },
    overwriting: true // this flag
  }
})

The downside, is that everytime your server restarts, will fetch the fonts again.

The other quick solution is removing node_modules/.cache/nuxt-google-fonts and starting the server again 😄

I decided to just download the variable font locally and use it.

asmeeee avatar Aug 24 '22 07:08 asmeeee

Yup, it seems to be it.

bloomlive avatar Aug 24 '22 07:08 bloomlive

I think I've found what is happening. The library depends on google-fonts-helper. This helps with the download of the fonts. When the execute method is called, it verifies that the .cache/nuxt-google-fonts exists. In case that it does, it returns (ref)

  // google-fonts-helpers
  if (!overwriting && fsExtra.pathExistsSync(cssPath)) {
      return;
    }

I was able to update my fonts adding the overwriting flag

// nuxt.config.js

export default defineNuxtConfig({
  modules: ['@nuxtjs/tailwindcss', '@nuxtjs/google-fonts'],
  googleFonts: {
    families: {
      Roboto: [100, 300],
      Lato: [100, 300, 500]
    },
    overwriting: true // this flag
  }
})

The downside, is that everytime your server restarts, will fetch the fonts again.

The other quick solution is removing node_modules/.cache/nuxt-google-fonts and starting the server again 😄

god bless you , hours trying to find the problem. Thanks brother

carlosmori avatar Sep 27 '22 00:09 carlosmori

In next release https://github.com/nuxt-community/google-fonts-module/pull/105 it will be detected automatically

ricardogobbosouza avatar Oct 14 '22 19:10 ricardogobbosouza

Please try v3.0.0-1

ricardogobbosouza avatar Oct 25 '22 14:10 ricardogobbosouza

If the problem persists, please reopen

ricardogobbosouza avatar Oct 27 '22 11:10 ricardogobbosouza

Works fine with the latest, thanks Ricardo! 🙏🏻

That fixed the following question on SO: https://stackoverflow.com/q/74337462/8816585

kissu avatar Nov 07 '22 00:11 kissu