Closed yanquanfahei closed 3 weeks ago
There isn't a straight-forward way to accomplish this, at least not in the scope of style-dictionary. Since you're doing multiple SD instances / runs, it will always put them in separate files. You can run a custom script to then chain those files together in a combined output file, but I wouldn't recommend it. What you get there is your light CSS and your dark CSS in the same file, which means the end user is always loading a bunch of redundant CSS because you can't be in light and dark mode simultaneously. It's often better to split them into their own respective light.css / dark.css files and have a client-side JS utility that switches out the stylesheets when the theme is changed by the end user.
The README of this project goes a bit more in-depth on this topic btw https://github.com/tokens-studio/lion-example and what this redundant CSS is and why we try to prevent this.
Thank you very much for your reply. It has been a great help. The implementation of this example has solved my current problem 😄
How can I change the configuration in the example to generate the following result: