TrueCar/gluestick

Flash of unstyled content on initial load on development

threehams opened this issue · 1 comments

Currently, the page loads unstyled, then loads in all styles afterward. This doesn't affect production, but it makes it difficult to see differences between server and client render - and one current goal is to eliminate content jumping as much as possible, especially on mobile.

universal-webpack includes a section on how to inline styles on initial render. It's a bit of a hack, but it eliminates the problem.
https://github.com/halt-hammerzeit/universal-webpack#flash-of-unstyled-content

We can't really use universal-webpack for it becuase it's too strict or not as configurable as we need. At some point it will be probably removed from gluestick (right now we use 1 small function from it).

About FOUC: if it's really that much of an issue, I will try to came up with the solution for it, but please note that build/recompilation time will increase, which might be a problem for bigger projects, thus it will be a optional feature.