Currently, I am working on developing an Angular2 application using webpack. My goal is to set different CSS themes based on the user's characteristics.
For example: When a male user logs in, I want the backgrounds to be blue; and when a female user logs in, I want the backgrounds to turn pink.
I have attempted to change the CSS values using setAttribute
or style.property
, but this method does not work effectively as the DOM gets destroyed when switching tabs within the application. The changes need to be somewhat permanent.
I also tried using separate CSS stylesheets (one for each theme) and connecting them to my HTML file using JavaScript when a user logs in. However, I faced an issue where webpack automatically adds my CSS to the HTML during app building.
Any suggestions or guidance would be greatly appreciated.