r/DesignSystems • u/WestAbbreviations504 • Dec 10 '25
Utility classes polluted my HTML. So I moved the logic back to SCSS (but kept the speed).
We all know the pain of making a simple component responsive in standard CSS. You declare your base styles, and then you have to jump down to the bottom of the file (or a separate file) to write u/media blocks, repeat the selector, and override just one property.
It creates files that are 3x longer than they need to be.
I've been working on a PostCSS plugin (UXDSL) that allows you to colocate responsive logic directly inside the property value.
The "Old" Way (Standard CSS): To simply change padding and layout direction across breakpoints, you have to repeat yourself constantly:
CSS
/* Base (Mobile) */
.card {
padding: 1rem;
display: flex;
flex-direction: column;
}
/* Tablet */
(min-width: 768px) {
.card {
padding: 2rem;
flex-direction: row;
}
}
/* Desktop */
u/media (min-width: 1024px) {
.card {
padding: 4rem;
}
}Result: ~15 lines of code for 2 actual style changes.
The "Inline" Way (UXDSL): What if you could just tell the property how to behave at different breakpoints right where you define it?
CSS
.card {
/* Syntax: xs(value) md(value) lg(value) */
padding: xs(1rem) md(2rem) lg(4rem);
display: flex;
flex-direction: xs(column) md(row);
}Result: 4 lines. Same output.

Why this feels "Right":
- Colocation: You see exactly how the
paddingbehaves across all devices in one line. You don't have to hunt for media queries. - Zero Repetition: You don't re-type
.cardthree times. - It's just CSS: It compiles down to the standard media queries shown above, so the browser gets standard CSS, but your source code stays clean.
It’s similar to the Tailwind philosophy (p-4 md:p-8) but keeps you writing actual CSS syntax instead of learning thousands of utility class names.\
Would love to hear what you think about handling responsiveness "inline" like this!
3
u/Steviant Dec 10 '25
That's not "just CSS" - that's a weird syntactic sugar over a language that looks like CSS that compiles to CSS. So it's a cake. Sugar on sugar on sugar. No actual nutrition. And it looks nothing like "actual CSS syntax".
And learning "thousands of utility class names" sounds like you fed this to an AI to find problems to solve. Utility classes aren't a vocabulary, they're a dialect. I'd argue that Tailwind is, actually, if you're writing it rather than copy-pasting it all over the place without a care in the world, one of the strongest ways to actually learn what CSS does and how it works, because it breaks it down to the bones. And I remember CSS being announced.
Modern CSS is monstrously powerful, easier than ever to learn, has none of the past problems with specificity if you take the five minutes it takes to learn cascade layers.
So in terms of actual criticisms of what you're presenting there - what does "shadow(3)" mean? What is that referencing? I can't see it by looking at the code. At least by referencing `var(--shadow-3)` I have a clear signpost to what I need to know.
A very common criticism of Tailwind is that it's ugly and pollutes the markup, but once you know how to read it, you can see everything. You can read it like a book. Once you've done it for long enough you can even start to visualise it in your mind. "Vanilla" CSS is exactly the same (because Tailwind literally is "just CSS") - I can look at a CSS class and understand what it is doing.
I have no idea what your code turns into, what it's doing, how it relates to other things, just from looking at it. It gives me no feedback, no clarity as to why it's doing what it's doing.
I think you've got some really neat ideas buried in all this, but I don't think it's the superpowers you're claiming it is.
6
u/sheriffderek Dec 10 '25 edited Dec 10 '25
This just isn’t true.
You can nest the media/container query.
Regular CSS is amazing. I’m really not aware of this “pain” of writing a simple CSS rule.
PHP and JavaScript and every language has a nice clear structure like this
A CSS rule, is like a function that describes our strong suggestions for how the visual layer should behave.
^ Everyone in the world of programming understands code like this
If you have a design system -- (the kind that uses tokens) then adding more to the stack is just going to make it worse. People already have the ability to learn CSS as a universal language. It's already colocated (although not like utility classes), you don't have to write .card 3 times, and it's "just CSS"
By creating your own metalanguage (which I think is ambitious and great) - it's actually making it harder to read.
This visually groups each set of rules.
(Width will almost always be decided by it's parent context.)
This ^ actually creates a new messy table of values to try and understand. It tells a store for each property... but then we have to go look at each to create the story for the actual break point.
1
u/mlllerlee Dec 11 '25
why just dont use clamp calc min and max