We need to talk about two use-cases separately: CSS for design systems is fine. You can define a .button[data-variant=”primary”]. It’s intuitive, performant, makes sense. CSS for application code is terrible — specifically layout & typography. The different kinds of flex/grid layouts are tightly coupled to the dom structure. Tailwind is a great fit here: Title Subtitle When you remove layouting concerns and maybe typ…
Something like
.title {
@include type-heading;
&.LARGE {
@include font-size-large;
}
@include onMobile {
...something
}
}This has the advantage of being naturally rule based and amazingly succinct to write and understand. Needless to say I'm an odd duck, since I almost never see css written this way.
(edit: I forgot how to format code on HN)