At the crossroads — structuring CSS classes
Diving into CSS-in-JS and styled-components meant a short break from CSS. Returning to a previous project, explicitly calling for the use of HTML and CSS, caught me off-guard. What had I been doing? And why?
The issues were not so much with the styling per se, but with the structure of CSS classes. I found myself caught between either having to have very specific classes that could not easily be reused or having to have multiple classes for each HTML-element that could keep going until eternity.
More experienced developers seemed to have stood at the same crossroads, having developed structures to find their way out which eventually led to methodologies taking form, with their own pros and cons and spokespersons hammering in their missions.
One day, I’ll probably find myself taking sides. For now, I find myself having to choose and see for myself. But I seem to be longing back to styled-components and it’s ability to reuse components and still be able to tweak them ever so little with props.
Where have the CSS crossroads taken you?