-
-
Notifications
You must be signed in to change notification settings - Fork 428
CSS not applied to nested route layouts (server-rendered only) #1579
Comments
It looks like Sapper 0.28.0 included the layouts in the
|
You can fix it by removing
We should add a test though to make sure we don't break it again. Would you be able to send a PR with the fix and a test? |
Thanks @benmccann I have very little experience writing tests in JS but I will give this a go over the weekend. I'd love to get this in before the next release. |
That'd be great! Thank you! There's a sample app and tests for the css here: I would start by updating the sample app to reproduce the issue similar to your reproduction repo and then write a test that fails on |
This reverts commit f2cb6f4.
This should be fixed in 0.28.10. |
Hi, I'm facing something simillar. When page load in server side render (direct access eg: /dashboard), the script on page not work. But when in client side render (eg: navigating from login page -> dashboard), it work. Reproduce: https://github.com/tegalan/sapper-tailwind-bug-reproduce The problem occurs when:
|
@suciptoid can you file a new issue for this? It will get lost as a comment on a closed issue |
@benmccann done |
Describe the bug
When using a nested _layout.svelte component CSS does not appear to be applied to any markup defined within that layout component (the markup within the layout remains unstyled). When the component is subsequently hydrated the client JS does inject the relevant styles. This makes the bug hard to spot but its effects can be clearly seen if:
Some important clarifications:
Logs
There are no relevant error logs or warnings.
To Reproduce
Please find a minimal repro here: https://github.com/rodoch/sapper-repro
This is the base Sapper template with two changes:
src/blog
directory now contains a nested _layout.svelte file with one styled div.Again, the surest method to observe the behaviour is to disable JS in your browser or to simulate a throttled connection.
/blog
.Expected behavior
The styles defined in the layout component and any of its child components should be included with the server-rendered page.
Information about your Sapper Installation:
Tested with Chrome, Firefox, Edge latest
Local environment, Azure deployment
Dynamic application
Severity
Blocker
Additional context
I appreciate the work you did on #1505 and I feel bad coming back with another CSS issue! It's definitely getting there though.
I did consider the issue described in #1572 but I am using Rollup 2. I'm curious if this could be in any way related to #1564.
The text was updated successfully, but these errors were encountered: