score:0

Accepted answer

importing your css at all is applying it right away.

you'd probably be better off if you arranged your css in such a way that you could conditionally apply a single class to a parent element that would then apply styles from nightlight.css.

e.g. inside nightlight.css

.night button {
  /* styles for your buttons when they're in a night container */
}

.night p {
   /* styles for your ps when they're in a night container */
}

etc

and then have some code in your component to either add or remove the night class depending on whether or not darkmode is enabled.


Related Query

More Query from same tag