UnoCSS with SvelteScoped not working in Vite dev mode #3964
Unanswered
FireSpike0
asked this question in
Q&A
Replies: 1 comment
-
|
After further investigation I can reproduce it with the sveltekit-scoped example from the UnoCSS repository: It seems that if the EDIT: In my repository I still can reproduce the issue, regardless of whether the option mentioned above is set or not. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've created a simple project using SvelteKit with the official SvelteKit Npm template. After that I've configured SvelteScoped according to the official documentation. When starting Vites dev mode with
npm run devthe page initially loads and all styles are working. But if I edit the default routes HTML (e.g. appending or removing a single character within a paragraph) and reload the page (regardless of automatic or manual reload), the styles of the page break in most cases. "Break" in this context means, that UnoCSS styles will flash up for short time and then disappear. After some investigation I found out, that the styles in the head section always contain HTML instead of CSS, if the bug occurs:The style node if the styles work:
The style node if the styles breaked:
The HTML contained in the style node corresponds exactly to the HTML contained in my default route.
What I've found out is, that the flashing of the styles results from another style node, which is always removed when loading the page: It gets removed by the
client.jsfile of SvelteKit because this node is a style node with thedata-sveltekitattribute.Does anyone have an idea, what's going on here? Any help (or a hint, that this sounds more like a Vite / SvelteKit problem) would be very appreciated.
EDIT: I've pushed the repositry with my configuration files to https://github.com/FireSpike0/feedback
Beta Was this translation helpful? Give feedback.
All reactions