SASS doesn’t merge selectors or styles

Something I came across just now: SASS doesn’t combine similar styles or even selectors. I made a few simple styles and wanted to see what SASS would make of it.

As you can see, it didn’t do much of anything really. The styles are duplicate and the selectors are duplicate. I searched the interwebs a bit and found it might actually be a philosophical decision not to respond to this. SASS is meant for SASS, so write SASS code and write it clean. It seems like the easy way out, but in a way it makes sense.

If you don’t have too much variables (like the $blue I have at the top of my examples), mixins and extends, you can try converting your CSS to SASS on this page: or use the sass-convert command. They both run a nesting procedure for the generated output. :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.