3 ms·
SASS can be dangerous when it comes to nesting. It's so easy to just keep nesting rules, and before you know it you've coupled your CSS tightly to the structure
by judofyr 15y ago
SASS can be dangerous when it comes to nesting. It's so easy to just keep nesting rules, and before you know it you've coupled your CSS tightly to the structure on one specific page.
- bobfunk 15y agoCouldn't agree more. I'm actually starting to become very skeptical of my own use of compass and sass. SASS makes it extremely easy to generate loads of really complex selectors that are very tightly coupled to the HTML they are styling. Mixins also makes it very easy to end up with badly bloated CSS. When a mixin defines a gradient and you apply it to different selectors, you'll get the whole bunch of browser prefixed gradient declarations repeated in lots of different places of your final css. A simple class with the gradient defined used in the HTML will make the final CSS much leaner. Personally I've decided to limit my use of SASS/compass far more and follow a style much closer to what's described in this article.
- jwdunne 15y agoAnother thing is that, generally, the more nesting you add, the more inefficient the compiled CSS will be. Getting carried away with SASS-like nesting could very well produce a splodge of inefficient, single-use CSS.