Be nice. Or else.
Cambridge, Ontario, Canada Full-Stack Developer Joined almost 2 years ago
If I see a pattern repeating enough and I can confidently say to myself, "if I change one of these, I'm going to want to change all of them," I'll usually make a new class that serves as a higher level abstraction around that group of utilities. Card is a good example for sure.
I prefer not to do this for everything though, only when I see patterns. Otherwise you end up with this giant ball of CSS that's super coupled to your particular project, and you have to constantly make new classes even for parts of your UI that are never repeated, so your CSS size will grow linearly with your project size, which is death for maintainability in my experience.
I wouldn't use extend because it has a lot of nasty side effects on your source order, especially when a component tries to extend a utility, because it'll move that component definition to the same place in the stylesheet where the utility is defined, which means that component's styles may get precedence over other utility styles you might want to add as modifiers.
Instead, use mixins. This is really easy in Less because any class can already be used as a mixin, but if you are using Sass, I would extract a mixin from a utility as soon as I wanted to reuse it, and use that mixin in both the component and the original utility, like:
EDIT: Code samples don't turn out great here, so check out this gist instead:
Color picker updates are nice! I'd love to get an HSL picker one day though, drives me crazy that we use HSL in browsers but HSB in every design tool.
"But how is that design going to scale to larger screens?"
"How about we just stick some big grey bars on the sides and call it done?"
Be nice. Or else.
Designer News is a large, global community of people working or interested in design and technology.