Hacker News new | ask | show | jobs
by stoikerty 3886 days ago
I agree, nesting has been one of the most helpful parts in SASS to keep everything organised. Nestin is just harder to do right, you need some experience in organising files.

Even with the specifity I vastly prefer nesting to a bunch of files with flat selectors and a huge amount of globals where you need a lot of time just to understand which elements affect which.

The post is quite opinionated and puts every issue in a bucket, as if there is only one way to write CSS. A few examples would have been useful.

Not using Nesting is the worst offender in the list.

2 comments

The trouble is that untangling nested selectors can be a real challenge, especially if you have inheritance between them, and the implications can be chronic. On a project I was working on recently, a colleague reported to the team that the addition of one line of code to a SCSS file resulted in an increase in size of the target CSS by 800KB. Looking at the spaghetti code that had been written, none of us could work out how many rules were being combined out of the deceptively clean looking SCSS.

A recommendation for that project was to lint for some ground rules forbidding certain behaviours, nesting being one of them. I've actually been considering avoiding SASS altogether in the future.

Couldn't agree more there. I tend to avoid nesting more than 3 levels deep, because I don't want someone else looking at my code and cry.