www.ziglang.org icon indicating copy to clipboard operation
www.ziglang.org copied to clipboard

Page is rendered once without style on Firefox

Open erf opened this issue 4 years ago • 6 comments

Minor annoyance. I noticed the page is rendered once without style, before with style, which is is causing a flash of sorts. This happened on Firefox. I could not recreate it on Safari or Chrome. I'm on macOS.

erf avatar Sep 02 '21 14:09 erf

This is because Firefox much more eager about showing the user content than others and a good thing. This effect is very reproducible if you artificially slow your internet speed in dev tools as it is a result of the css being an "external" resource from the html of the page.

nektro avatar Sep 17 '21 22:09 nektro

Hmm. Performance is good, but don't think the flashing is a good thing though. Could style not be preloaded before showing page?

erf avatar Sep 17 '21 23:09 erf

the browser is not able to determine that the css even exists until it reaches the <link> tag

nektro avatar Sep 17 '21 23:09 nektro

but the link tag / css is loaded before the body, no?

erf avatar Sep 18 '21 08:09 erf

no

nektro avatar Sep 18 '21 08:09 nektro

I guess it's an async operation to load the links and you would hook on to a callback (onload?) when everything is loaded and then render the body with the correct style, but that is probably out of scope of hugo which is used here ..

erf avatar Sep 18 '21 09:09 erf