Re:Show HN: Lissom.CSS - A classless, minimalist, and themea...
by Looky1173 on Tuesday June 20, 2023 @09:29AM
(#36403670)
It's mainly the latter. I did consider just using a class, but ultimately settled on this solution. This approach might facilitate usage with additional CSS compilers/tooling.
Re:Show HN: Lissom.CSS - A classless, minimalist, and themea...
by canadiantim on Tuesday June 20, 2023 @10:32AM
(#36404589)
I admit I become hesitant when I see "data-*" attributes as it makes me think Javascript might be necessary to use it
Re:Show HN: Lissom.CSS - A classless, minimalist, and themea...
by Looky1173 on Tuesday June 20, 2023 @10:34AM
(#36404630)
"data-*" attributes don't require any JavaScript; their values can even be accessed from CSS with `content: attr(data-*);`
Re:Show HN: Lissom.CSS - A classless, minimalist, and themea...
by stronglikedan on Tuesday June 20, 2023 @10:24AM
(#36404443)
I like the distinction. It separates effects applied by the library from affects applied by your custom class, since you can still add a class if you like. At a glance, I know where the effects are coming from.
Re:Show HN: Lissom.CSS - A classless, minimalist, and themea...
by lucideer on Tuesday June 20, 2023 @11:45AM
(#36405739)
This is a good point. It also makes reasoning about classlists more clean, if all are guaranteed to be managed by your own code.
Re:Show HN: Lissom.CSS - A classless, minimalist, and themea...
by robgibbons on Tuesday June 20, 2023 @11:22AM
(#36405316)
That caught my attention immediately. It just seems like a hacky, roundabout way to avoid using classes for different button styles, which to be clear, are an example of exactly why classes exist.
> To make a button primary, add the data-primary attribute to it.
For things like this, I feel like a class would be ok while still calling the library "classless". Is there some advantage to using a data-* attribute here or is it just to retain "purity" of the classless tagline?