How To Stop Writing Messy & Unscalable CSS
“I have 4 .css files and in total, they’re over 10,000 lines of code. How did things get so big?”
CSS files can get out of control, pretty quickly.
But it doesn't have to be this way.
Let's dive into some actionable CSS techniques to help you write ...
scalablecss.hashnode.dev
On a side note, we need to be careful of what is defined there since it's "universal" and everything will use those properties. Some elements also have no reason to use them, which also brings us to a huge issue when using a universal selector.
Just like BEM - to semi-quote a previous thread - it turns your code into a proverbial garbage pail; encouraging bad practices and unnecessary code bloat. Inheritance is important, and when you ignore the fact that styles are handed down from parent elements... you're missing the point of writing DRY code (aka "Don't Repeat Yourself").
We often make the mistake of considering the CSS file the defining factor of style for an interface, however, we don't often use a single
classwithin the markup when assigning it to an element within the HTML. The result is a CSS file that seems to be DRY, but defeats the purpose by redefining the same properties within eachidorclassname that's used.Even though I disagree a bit, I like articles like this, because it will inspire folks to deep dive for more information.
Jason Knight was a brutal critic in many of his posts, but sometimes the truth hurts.
Source: hashnode.com/post/css-methodology-to-bem-or-not-c…