In my current project, the CSS is being generated from Sass using webpack. Within the project, I have defined some Sass variables for theming purposes such as $color-primary, $color-bg, and more.
My goal is to have both a light theme and a dark theme. While compiling to two separate CSS files like app-light.css and app-dark.css is not an issue, the challenge lies in the fact that these files share many styles that are not theme-specific.
I am looking for a solution to identify and extract all selectors and properties that are theme-specific to be saved in app-dark.css. This way, app-dark.css will only include data that is relevant to the particular theme.
For example, when comparing app-light.css and app-dark.css side-by-side, the desired output would be:
https://i.sstatic.net/2mwrc.pngI am seeking a tool or method to automatically generate app-dark.css with only the theme-aware properties and selectors, like h1 { color:#fff; }
, as shown in the diff.