- Nesting:
.anElement {
&_aBlock {
…
}
&_anotherBlock {
…
}
&_anotherBlockAgain {
&:hover {
…
}
}
}
- Limiting Nesting to Pseudo Elements:
.anElement {
…
}
.anElement_aBlock {
…
}
.anElement_anotherBlock {
…
}
.anElement_anotherBlockAgain {
&:hover {
…
}
}
LONGHAND ALL THE THINGS!
Seriously - production source code should be a work of art, in structure, conventions, comments, accuracy.
Source code will inevitably need to be picked up and worked on by other people at some point (unless it's a private project that you actually want to be unfathomable).
Optimisations change over time as the browser landscape, protocols and server technology changes, accurate source code means that build systems can handle the changing requirements for optimisation.
is fine if you're just throwing some styles together but in a large project, if I jump to:
&__bar { ...
on line 250 of a file, I need to scroll to the top to check which block I'm working in.