3 ms·
After using tachyons (http://tachyons.io/ http://tachyons.io/) I've gone the complete opposite direction. While tachyons takes it to an extreme, I found having
by barryhoodlum 9y ago
After using tachyons (http://tachyons.io/ http://tachyons.io/) I've gone the complete opposite direction. While tachyons takes it to an extreme, I found having many small classes that (generally) do one thing, then composing those classes in the HTML, is much nicer than giving each element one "semantic" class name and hiding all the complexity in the CSS, with the large file size and many duplicate rules that approach brings.
You are then not scared of changing existing classes, as they are so simple. In fact you rarely have to change them after writing them the first time. Often you can build a whole new component without writing any new CSS.
It works especially well with components, as it's OK if the HTML is "noisy" with many class names, as generally you're not dealing with large chunks of HTML at once.
- devdad 9y agoI actually take it one step further and have classes such as `border-1-px border-dark border-bottom standard-margin no-margin-top`. Seem weird at first but combined with flexbox (if your target is the evergreens) you never overwrite and you got one stylesheet for pretty much all of your projects. It's a real production boost. Really not a fan of CSS-in-JS. I like to keep my components JS+JSX only.