DEV Community

Discussion on: 8 SCSS Best Practices to Keep in Mind

Collapse
 
yawnxyz profile image
Jan Z

I learned to avoid nesting like this the hard way... this can make searching for certain classes with "cmd+f" extremely difficult, and I've sometimes spent way too long pulling out my hair looking for certain selectors:

.good {

  &__area {
    // Code
  }
}

To make my code more searchable but at the expense of "less beautiful code" I've been doing this more often (sometimes I do break my rule though):

.good__area{}
.good__section{}

@media {
   .good__area{}
   .good__section{}
}