-
-
Notifications
You must be signed in to change notification settings - Fork 432
Svelte/Sapper duplicates CSS styles #1127
Comments
@Conduitry In the small one-page project that I have sent a link to the version of Sapper is 0.27.10. In the bigger project it is 0.27.9. If I understand correctly from #1115, it's an issue that is being worked on. |
In my case this only happens if I use components. First, component styles are loaded without the id ( |
The same is happening on an open-source project I'm working on with Could you explain what's the easiest way to do the downgrade to Thank you 🤗 |
@sandrina-p have you tried I don't know how it might affect your project, but that's how you would downgrade. |
Can confirm this is happening to me on 0.27.8 still |
Temporarily solved by rolling back Rollup.. from |
Updating rollup to @2.7.6 solved the issue for me. |
@brewmycode Very interesting! I've confirmed this to also be the case in my own project. This definitely warrants updating the version of Rollup in the official template, although there is certainly some weird code in Sapper that should be dug into at some point. |
I've update the Sapper template to use Rollup 2, and closing this. I'm leaving #1115 open to circle back on cleaning up some of Sapper's code for CSS handling. |
Describe the bug
Svelte/Sapper duplicates CSS styles.
To Reproduce
I cannot reproduce this in REPL as I am also using Sapper. However, here's a simple example from a tiny project of mine, which you can find here (use Google Translate, if you need to, as the page is in Bulgarian) - just inspect any elements's styles.
Here's a simple CSS style that I use in
index.svelte
:Then, if I open the dev tools, I can see this:
These styles seem to have been inserted twice - first in
index.css
and then inline inindex
In a larger project I am currently working on, I observe similar behavior:
Expected behavior
CSS styles and classes should be rendered only once (or to be more precise - the number of times you've written them in your code).
Information about your Svelte project:
Note: Issue is not related to browser or OS, as I can reproduce it not only locally, but in production as well. Tried with a different laptop (Mac) as well.
Severity
I wouldn't say the issue is blocking anything, but I would say it's quite important as it seems like I am getting twice as much CSS as I need. And this could be an issue for larger projects like the one I am currently working on.
The text was updated successfully, but these errors were encountered: