Poppins 500 not downloading
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.
Same for Montserrat, it ignores all weights and injects only 400.
I'm having the same issue with Roboto. Is injecting only 400.
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:
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-fontsexists. 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
overwritingflag// 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-fontsand starting the server again 😄
I decided to just download the variable font locally and use it.
Yup, it seems to be it.
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-fontsexists. 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
overwritingflag// 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-fontsand starting the server again 😄
god bless you , hours trying to find the problem. Thanks brother
- Use the
overwritingoption
In next release https://github.com/nuxt-community/google-fonts-module/pull/105 it will be detected automatically
Please try v3.0.0-1
If the problem persists, please reopen
Works fine with the latest, thanks Ricardo! 🙏🏻
That fixed the following question on SO: https://stackoverflow.com/q/74337462/8816585