Loading CSS issue (FOUC) on optional parameter
I have setup a simple website with below route.
Building to a production website, the CSS for the /home component is included in the head
When I'm using optional parameter (https://start.solidjs.com/core-concepts/routing) as below
The CSS for the /home component is not included in the head.
As a result, the page show unstyled content for a while (depending on the network) and then load the CSS.
I have attached the simplified version.
visit http://localhost:3000/home -> Home css is loaded before the root.css
visit http://localhost:3000/home2 -> root css is loaded before.
How can I get the CSS to be loaded early? To avoid Flash of Unstyled Content?
SolidStart Beta Documentation
SolidStart Beta Documentation
Early release documentation and resources for SolidStart Beta
4 Replies
My SolidStart knowledge is not that great, but I don't think it has an integrated css solution
What are you using for CSS?
I'm using the default option.
https://start.solidjs.com/core-concepts/css-and-styling
SolidStart Beta Documentation
SolidStart Beta Documentation
Early release documentation and resources for SolidStart Beta
From the SolidStart template (https://start.solidjs.com/getting-started/project-setup), I add some style in root.css. For components, I use module CSS.
I think it has something to with the way the route with optional parameters load.
As a work-around, I can pull the CSS out as global scope (using Tailwind or just declare in root.css).
hello, have you find the solution? I am encountered this problem. FOUC could be removed in the CSR mode, however, the same code in SSR mode unstyled content will be shown a while.
I am using bulma css, and imported it in App.css
code is here: