DEV Community

Discussion on: SvelteKit Theme Switch

Collapse
 
ambrt profile image
Rik • Edited

Did anyone solved the fact that Vite doesn't autoreload on changes in Css files (HMR)?

I followed this article and that's the only problem i encountered.
The problems happens because Vite doesn't bundle css files hence it doesn't watch them.

The workaround i tired is to make conditional import but it left basically mix of all themes
on website.

Collapse
 
nico_bachner profile image
Nico Bachner

The reason for this might be because the styles are located in the static/ directory. I think that Vite assumes all the files there are in fact static, as the directory name suggests.
I have tried many ways to include the styles in the src/ directory, but none seem to be as simple as my current solution.
If you do find a way to include the styles in src/ in an elegant manner, please do let me know as I would love to improve my solution in all ways possible.