- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Just a quick question about the above that has been buzzing around our office today.
I am fairly new to LESS and very new to BEM methodology so wanted to bounce the idea off some experts to find out pros/cons. The idea being this:
If I write using the BEM methodology in LESS I can write like this:
block {
&__element {
&--modifier-one {
color: red;
}
&--modifier--two {
color: blue;
}
}
}
that will compile to:
block__element--modifier-one {
color: red;
}
block__element--modifier-two {
color: blue;
}
Now to me that seems like a nice way of writing it within less and it will also make it easier to maintain in the long run but a quick web search hasn’t bought anything up and that makes me worry that I have overlooked something very important!
What do you guys think?
Seems perfectly fine to me. I just covered that a little in this article in the nesting section. Good to know LESS works the same way.
My team have just been discussing this very issue and have decided to go for it.
It links things to better really nicely so we think it will be good for us.
Hey I know this is old, but you have a bug in
&--modifier--two {
Should be
&--modifier-two {
:)