Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading fonts causes flickering in dev mode #181

Open
lostful opened this issue Jun 22, 2024 · 7 comments
Open

Loading fonts causes flickering in dev mode #181

lostful opened this issue Jun 22, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@lostful
Copy link

lostful commented Jun 22, 2024

Whenever I reload my page the font flickers

Copy link

dosubot bot commented Jun 22, 2024

Hey @lostful! I'm here to help you with any bugs, questions, or contributions you have in mind. Let's tackle this flickering font issue together!

To fix the issue of font flickering whenever you reload your page, you can use the nuxt-fonts module to optimize and configure web fonts in your Nuxt app. Here is how you can set it up in your .nuxtrc file:

typescript.tsConfig.compilerOptions.noUncheckedIndexedAccess=true
modules[]=nuxt-fonts-devtools

This configuration will help in optimizing the fonts and reducing the flickering issue [1].

To continue talking to Dosu, mention @dosu.

@danielroe
Copy link
Member

Is this only in development?

Copy link

Would you be able to provide a reproduction? 🙏

More info

Why do I need to provide a reproduction?

Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.

What will happen?

If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritise it based on its severity and how many people we think it might affect.

If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.

How can I create a reproduction?

We have a template for starting with a minimal reproduction:

👉 https://stackblitz.com/github/nuxt/fonts/tree/main/example

A public GitHub repository is also perfect. 👌

Please ensure that the reproduction is as minimal as possible. See more details in our guide.

You might also find these other articles interesting and/or helpful:

@lostful
Copy link
Author

lostful commented Jun 22, 2024

Is this only in development?

Ah yes, this is only in development. Is that intended?

@danielroe
Copy link
Member

Not intended, but I did observe it previously. Need to investigate, so let’s leave it open.

@danielroe danielroe changed the title Flickering Loading fonts causes flickering in dev mode Jun 27, 2024
@danielroe danielroe added bug Something isn't working and removed needs reproduction labels Jun 27, 2024
@kickthemooon
Copy link

same here
i have the font in my css like this

@font-face {
  font-family: 'Quicksand';
  src: url('/fonts/quicksand/Quicksand-VariableFont_wght.ttf') format('TrueType');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

and the actual file is in the public directory public/fonts

maybe I should do it differently?

@danielroe
Copy link
Member

This looks like an upstream vite bug to me - likely caused by the fact that:

<link rel="stylesheet" href="/_nuxt/__uno.css">

returns a JS module and not CSS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants