Closed RamiAwar closed 3 years ago
Hi @RamiAwar thank you for the kind words! Yes SSR support would be highly beneficial I'll take a look at removing the dependencies
@RamiAwar I've pushed an update to svelte-themer@next
which should resolve the issue. Once I am able to confirm I'll publish to 0.4.4
That was fast! I'll test it now!
It's all good on my end! Thanks!
Also in case you haven't seen this already, this is the only warning I see in your code.
"CONTEXT_KEY" is declared in a module script and will not be reactive - svelte(module-script-reactive-declaration)
Also, MediaQueryList.addListener seems deprecated, can be replaced by:
darkSchemeQuery.addEventListener(
"change",
({ matches }) =>
mode === "auto" && currentMode.set(matches ? "dark" : "light")
);
I went ahead and updated the event listener. For the context key it appears since it's used in the reactive statement to update the context it's showing that warning. That key does not change therefore I think it's safe to ignore that warning for now. I'll get this merged!
merged and available under 0.4.5! let me know if you run into issues! closing for now
Hello Jose,
Great writeup on svelte theming! I came here after I failed to persist the themes myself, but it looks like I'll face the same issue here. If I'm using Sapper, or any other kind of SSR, then I won't have access to the window variable in my code (or localStorage or sessionStorage ...). Is there any way to remove that dependency? I see you use it to check the preferred mode of the browser. I noticed your localStorage is properly set inside onMount however!