nuxt-modules / color-mode

Dark and Light mode with auto detection made easy with Nuxt 🌗
https://color-mode.nuxtjs.org
MIT License
1.12k stars 112 forks source link

fix: inject color-mode script with nitro plugin (handles mixed spa/ssr) #164

Closed danielroe closed 2 years ago

danielroe commented 2 years ago

This PR, instead of injecting the script with a client-side plugin, adds it via a nitro plugin. This should improve stability and reduce the client-side JS payload.

More importantly, it also handles the case of rendering a SPA fallback in an otherwise SSR deployment, which was otherwise broken.