Last Updated: February 25, 2016
·
746
· thekidcoder

SASS Nesting

When using SASS (or SCSS, LESS) it can be very tempting to use its nesting features heavily. DONT!.

When I came into SASS from a programming world I thought nesting would be a great way to maintain scope and keep my code organized. I quickly realized that nesting more than 2 or 3 levels deep will cause massive headaches.

Instead of trying to deal with specificity in your css declarations, focus on naming your classes properly and abstracting common elements!

2 Responses
Add your response

Why do they cause massive headaches for you?

over 1 year ago ·

While at first nesting can seem great for code clarity it can become very difficult to maintain your abstractions. You can quickly fall into too-targeted-selector-hell quickly on large projects.

over 1 year ago ·