Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
tenphi
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
3 ms
·
1.
▲
Runtime CSS-in-JS deserves a rehearing
(tenphi.me)
1 points
by
tenphi
29d ago
|
0 comments
2.
▲
Okhst: A tone-based color space for predictable UI palettes
(tenphi.me)
2 points
by
tenphi
3mo ago
|
0 comments
3.
▲
by
tenphi
5mo ago
You are right. I doubt it can cause any issue by itself, but with complex states it might end up being `.class:where(.root .class:is([state1], [state2])`. Still, it should be fast enough. Anyway, I prefer a fully deterministic approach that
4.
▲
by
tenphi
5mo ago
I was, but now it's written in the code.
5.
▲
by
tenphi
5mo ago
For example, I want to set (override the inherited one) a custom property by default, but not when some condition is met. Yes, it might be solved with `inherit`, but in other cases `initial` should be used. I prefer not to define anything u
6.
▲
by
tenphi
5mo ago
Actually, most importantly, AI can read and edit styles. CSS is hard enough on its own; adding overrides makes it so complex that it becomes unmanageable at scale.
7.
▲
by
tenphi
5mo ago
Exactly. And we won't find out if we don't try. Also, specifically, this approach is more JSON-based (compared to other CSS-in-JS). So you can easily put styles into a separate file if you want, JS or JSON. But I prefer defining s
8.
▲
by
tenphi
5mo ago
It took me years to picture "how things fit together as they get more complex and different styles logically overlap". I hope we didn't lose you :) Considering the `:where` approach, I would say it might work most of the time
9.
▲
by
tenphi
5mo ago
If you lack a solid component system, you likely do not require complex tools to manage CSS.
10.
▲
by
tenphi
5mo ago
Great, if it suits your needs. In a big enterprise product, it would be a waste to have so many CSS that are not actually used. Also, maintaining this seems like a nightmare to me.
11.
▲
by
tenphi
5mo ago
Because usually each style requires its own set of states, and raw strings are hard to type (in Typescript). But there are even more reasons. `styled-components` is just an advanced CSS injector. We used it as an injector in the early versi
12.
▲
by
tenphi
5mo ago
Sorry to hear it. I didn't. And now our designers can tweak the code directly to adjust component styling. They can finally read and edit styles.
13.
▲
by
tenphi
5mo ago
Happy to take questions! I built this because I kept hitting the same wall: CSS state resolution is opaque when states overlap, and extending components means mentally re-deriving the whole selector matrix every time. Some topics I'm c
14.
▲
I spent years trying to make CSS states predictable
(tenphi.me)
79 points
by
tenphi
5mo ago
|
58 comments