4 ms·
You can use LESS's nested syntax in order to generate prefixed CSS classes instead of nested CSS selectors, if you prefer them. That gives you the advantage of
by wallunit 13y ago
You can use LESS's nested syntax in order to generate prefixed CSS classes instead of nested CSS selectors, if you prefer them. That gives you the advantage of prefixed CSS classes, but you don't have to repeat the prefix and you have all classes with the same prefix grouped together, which IMHO makes large projects easier to maintain.
.textfield {
&-label {
...
}
&-input {
...
}
}
- ianstormtaylor 13y agoThat is pretty cool. I think generally that the components themselves should be more limited in functionality to the point where it's just not that big of a deal to write out `textfield` two more times. As in, I think it's optimizing for a case that isn't that important. If you write a component, the number of times you're going to change the root class name of the component is very small, so it doesn't need quick rename-ability. And then the number of nested elements inside of it should also be small, so you don't have that many gains there either.
- erichurkman 13y agoOne downside to this is it makes grepping for code a little more difficult. (Sourcemaps are one solution.)