NuxtN
Nuxt3y ago
12 replies
Brad Landis

Remove styles in a component when unmounted

We have "flavors" that is set based on URL, but in test, we use query string to toggle, but it requires reloading the entire application because styles aren't unloaded once loaded.

I have a layouts for each flavor with <style>import '[flavor]/styles';</style> in a component, and when I change to another layout it will load flavorB styles, but doesn't unload flavorA styles that is no longer loaded.

How can I unload those styles when the layout gets unmounted?
Was this page helpful?