t produces more legAt a recent CSS meeting I asked, “Who uses Sass in their daily work?”. The response was overwhelmingly positive; Sass is no longer reserved for fancy projects and experiments, it is fast becoming the standard way to write CSS.
But that’s great news! Sass provides much more power over complex, ever-growing style codes, including new singapore phone number data capabilities such as variables, control directives, and mixins that the original CSS specification (intentionally) lacked . Sass is a stylesheet language that is robust yet flexible enough to keep up with us.
Unfortunately, while Sass is being widely adopted (which I cheer about), I’m also seeing a steady decline in the quality of the CSS being produced (which I mourn). The reasons are clear: Sass introduces a layer of abstraction between the author and style rules. And we need to somehow translate the web standards — for which we fight so hard — into this new environment. The problem is that the Sass specification expands so much that any set of standards would require constant reworking. That’s why you need to have something else, a script — one that’s outside of Sass, but still presents a way to code.
Let’s explore some of the trouble spots first
One well-documented misuse of the Sass feature set is the tendency to over-nest CSS selectors . Don’t get me wrong, nesting is beneficial; groups code to make style management easier. Deep nesting is more problematic .
First, it creates long selector strings that affect performance:
body #main .content .left-col .box .heading { font-size: 2em; }
Furthermore, it can cause confusion price tricks in marketing with specificity. It can force you to create additional selectors with more specificity to override styles that are higher in the cascade — or, god forbid, force you to resort to
Finally, nesting can reduce
The portability and maintainability of styles because selectors are bound to cg leads HTML structure. If we wanted to repeat the heading style for a box that was not in the left-col, we would have to write a separate rule to achieve this.