Taking inspiration from tailwindcss and this idea, here is a specification for how to achieve it.
With TailwindCSS you have an amazing default design system, but it is not ideal. It lacks:
- Validation of classnames: It does not validate the classnames you insert
- Composition: It does not allow you to effectively compose together classnames into new classnames and it can not dynamically do so at runtime effectively
- Defining by variables: Even though it is nice to write TailwindCSS inline with your elements, you can not define classes as variables, because the TailwindCSS extension does not understand it
This solution solves all of this with an even better experience of setup and consumption!