Hello experts.
we are developing a project with Demo1 and now we would like to add dark mode to it dynamicly. But the problem is that dark mode doesn't work with adding "dark-mode" class to the body.
Dark mode works fine with importing realated scss files but we are gonna toggle the theme dynamicly, that's why we wouldn't link to work with imorting scss files bucause as far as I know we are not able to access style section by js scripts.
Anyone can help me?
Hi,
You can add a webpack script to bundle dark and light mode sass separately and then connect them directly to the public/index.html file.
Then you should be able to toggle these style files from your javascript code.
Check examples in StackOverflow page below:
https://stackoverflow.com/questions/574944/how-to-load-up-css-files-using-javascript