3 ms·
The biggest problem with CSS today is that the source code is the product. One possible solution to this problem is to use SASS (http://sass-lang.com http://sas
by tjogin 15y ago
The biggest problem with CSS today is that the source code is the product. One possible solution to this problem is to use SASS (http://sass-lang.com http://sass-lang.com), thereby separating the concerns of the quality, structure, reusability (etc) of code from the aspect of browser rendering efficiency.
Many of the aspects of CSS Nicole is trying to improve with OOCSS/CSSLint simply vanishes when you use SASS (though some still stand). Some of the points as they pertain to CSSLint: https://github.com/stubbornella/csslint https://github.com/stubbornella/csslint
Take for instance the issue of reuseability. Nicole's solution to that is less CSS selector specificity, to not use IDs, and to sprinkle containers with several modular CSS-classes. By using SASS functions, mixins and extends you can achieve that without doing either of those things.
I much prefer using SASS to manage my source code and the related concerns, without resorting to these kinds of sacrifices.
- billybob 15y agoI know some of the things that SASS gets you, but I'm curious: how DRY and light is your generated CSS? Anecdotally, the designer where I work uses SASS, but in our last iteration of our web app, his compiled stylesheet was something like 10,000 lines.
- tjogin 15y agoIt depends on how you use SASS. Used correctly, with @extend rather than @include for big swatches of styles that reoccur in multiple places, it will be DRY and light. Your designer colleague probably didn't have a sufficient understanding of the difference between @extend and @include. It's not hard though, a few tests using the different methods and analyzing the results should be enough to understand when to use each. It is utterly impossible to generate worse CSS with SASS than by just writing CSS directly, as SASS does not deprive you of any CSS feature. SASS provides you with a bigger and more capable toolbox, but won't stop you from using the wrong tool in any given situation.