3 ms·
Actually, nesting like that creates unneeded higher specificity. You'll end up with .titlebar .titlebar-button and you'll end up running into race-conditions wi
by anthonyshort 13y ago
Actually, nesting like that creates unneeded higher specificity. You'll end up with .titlebar .titlebar-button and you'll end up running into race-conditions with specificity and the ordering of your CSS will then become important.
You're often better off just using BEM style selectors and using the selector name for nesting.
.titlebar {}
.titlebar-button {}
As for mixins, yeah, you get some benefit if you're trying to be super tricky. But that button you've created is used once or twice, plus you could just use CSS variables and colour functions.
The question is now whether the added complexity everywhere else is worth that tiny benefit. There are plenty of people who have built large front-end sites and found that Sass/Less in fact make it harder to maintain.
But honestly, this stuff is totally subjective in a lot of cases. Different projects, different tools. If it works for you then stick with it, for other people, Myth and Rework are perfect.
- porker 13y ago+1 for BEM, OOCSS or whatever each author calls it (Snook has his own name IIRC). Having written CSS for a decade and decided what semantics CSS had and how it should be structured, I was very surprised when I actually gave BEM/OOCSS/Whatever a go. It works. And I don't like going back now.
- sogen 13y agothx for the BEM tip!