Hacker News new | ask | show | jobs
by netgusto 2878 days ago
I'm experiencing a Flash of unstyled content at every pageload.

I think this could be improved by moving the stylesheet up in the DOM (in the head, and not at the end of the body as it's the case now).

1 comments

It's not that the CSS is linked at the end of the document but that the CSS is only loaded by Javascript after the document has finished loading.

That's ... unusual to say the least and if I'm honest, the wording "most stupid, brain dead thing I've seen in a long time" was the first thing that crossed my mind.

I can't remember what the logic for that was. I think I was messing around trying to see if I could appease google pagescore on such a tiny page, and eventually I just gave up and left as it was.
Oh, I see now where this is from: https://developers.google.com/speed/docs/insights/OptimizeCS...

That's quite an ugly optimization step. You left out the step where you inline the necessary CSS styles in the head that's why the unstyled page flashes up for a second. But as you use bootstrap, this might be a lot to inline and not worth the effort.

I'd say this is a case where you shouldn't care too much about a highscore :-)

Yeah, I tried inlining it, and it turned out it was going to be a massive amount of CSS :)

Maybe I'll just bite the bullet and do my own CSS.