| > Rather than being tightly linked to structure, these are very loosely coupled - this is why one can often wireframe an entire application out before styling it! Here's one of the premises on which the article was written - and I must wholeheartedly disagree. If you're looking to write clean, maintainable CSS - you MUST consider DOM-structure of the thing you're styling as well. Too often, quirky CSS selectors are written, only because someone failed to foresee how HTML and CSS work together to create a visual. This decoupling of the HTML that's written, and a CSS "theme" being written/applied after the fact, is also where things like negative margins (ugh) and the like tend to come from. Now, I've been working on a very large component library in React, and keeping our CSS maintainable has not been an issue. We've got one (S)CSS file per component, and it resides in that component folder. And while the file is separate, we absolutely do not allow anyone to develop any component anymore, without having any knowledge of how to style the thing. We used to do exactly that: other devs would develop component, we would try to style them afterwards. This always results in either us writing messy CSS with crazy selectors or - and more often - we simply opted to re-write the entire HTML, to suit our styling needs. At this point in time though, I would love to write some CSS-in-JS here. Too often we need to use variables based on JS logic; And it ends up as an inline style right now, anyway... All in all, if the writer believes HTML and CSS can be written separately, without resulting in a terrible mess, I'm having a lot of difficulty accepting that they know what they're talking about. Sounds like they never had to work on, or maintain, a large application. |