Dealing with the flash of unstyled content (FOUC) problem #222
-
Do any of you have a preferred method for dealing with the flash of unstyled content problem in an îles site? I know that Vue has some mechanisms for dealing with it, like |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hi Luc! If you provide a specific example, I might be able to pinpoint what the problem might be in your scenario. When using site generators like Hugo or Jekyll, any JS components would be rendered only after hydration, causing FOUC and layout shifts. îles allows you to avoid both problems. With îles, Vue components are pre-rendered (leveraging Vue's SSR capabilities), so the HTML is available before JS kicks in. As a result, in most cases (example) an îles site will look exactly the same even if JS is disabled. |
Beta Was this translation helpful? Give feedback.
-
@ElMassimo Hello! Here is the site in question: https://zero-to-nix.com. To be clear, I haven't been able to reproduce it and the issue was reported by someone else, so it could be a browser issue. The repo for the site is here in case you wanted to have a look. I don't think we're using îles in an exotic way so I'm not sure why the user might be encountering this. |
Beta Was this translation helpful? Give feedback.
-
@ElMassimo Sigh, actually it turns out that the issue was a Firefox extension that something was using. Once they disabled the extension the issue completely disappeared. So îles is 100% not at fault here. As always, excellent work 💯 But I appreciate your tips here very much. Indeed, probably best to cut down on bloat wherever possible. |
Beta Was this translation helpful? Give feedback.
Hi Luc!
If you provide a specific example, I might be able to pinpoint what the problem might be in your scenario.
When using site generators like Hugo or Jekyll, any JS components would be rendered only after hydration, causing FOUC and layout shifts. îles allows you to avoid both problems.
With îles, Vue components are pre-rendered (leveraging Vue's SSR capabilities), so the HTML is available before JS kicks in.
Since Vite will extract styles and CSS is a blocking resource, the first render would already have the necessary styles and HTML.
As a result, in most cases (example) an îles site will look exactly the same even if JS is disabled.