A developer with M.Sc. in Computer Science. Working professionally since 2010. In my free time I make music and cook.
Also I don't and after the recent events will not have Twitter.
Location
Budapest
Education
Eötvös Loránd University (ELTE - Budapest Hungary) Computer Science M. Sc.
I've got confused with a thing here when you wrote "would be considered as a block". Maybe I misunderstood something here, but I understand this .tag-list__tag.github to look like this in HTML: <div class="tag-list__tag github" />
Then I don't see how this would result in a new block (or maybe in the css file? 🤔). I think I get something wrong here.
I think what they mean is that in BEM notation, a single class would correspond to a block.
Think of a class like github__element--modifier, where github is the block part; so on its own, github is just the surrounding block level item without any modifiers. I don't use BEM so I might be misunderstanding some of the nuance here.
Thank you for your comment. Indeed, without context, it's hard to understand which block I meant. I have revised the comment a bit, and @darkwiiplayer has described everything correctly as well, thank you!
Overall, BEM is primarily about conventions, and nothing stops you from adapting them to the needs of your project. Personally, in this project where I used this approach, each BEM block is in a different CSS file. If I were to use github as a separate BEM block, I would need to put it in a separate file as well, which I don't like.
A developer with M.Sc. in Computer Science. Working professionally since 2010. In my free time I make music and cook.
Also I don't and after the recent events will not have Twitter.
Location
Budapest
Education
Eötvös Loránd University (ELTE - Budapest Hungary) Computer Science M. Sc.
Thank you everyone for the explanation! Once they pointed out "B" is standing for block I understood it immediately.
I also didn't get it as I'm more pragmatic about it; I can tolerate some files containing other things as long as the file is small and no one is reusing the code in it.
It's not so much about tolerating it, but more about the fact that it violates the BEM rules, which state that styles of one block should not be present in the files of another block.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I've got confused with a thing here when you wrote "would be considered as a block". Maybe I misunderstood something here, but I understand this
.tag-list__tag.github
to look like this in HTML:<div class="tag-list__tag github" />
Then I don't see how this would result in a new block (or maybe in the
css
file? 🤔). I think I get something wrong here.I think what they mean is that in BEM notation, a single class would correspond to a block.
Think of a class like
github__element--modifier
, wheregithub
is the block part; so on its own,github
is just the surrounding block level item without any modifiers. I don't use BEM so I might be misunderstanding some of the nuance here.Hey @latobibor !
Thank you for your comment. Indeed, without context, it's hard to understand which block I meant. I have revised the comment a bit, and @darkwiiplayer has described everything correctly as well, thank you!
Overall, BEM is primarily about conventions, and nothing stops you from adapting them to the needs of your project. Personally, in this project where I used this approach, each BEM block is in a different CSS file. If I were to use
github
as a separate BEM block, I would need to put it in a separate file as well, which I don't like.Thank you everyone for the explanation! Once they pointed out "B" is standing for
block
I understood it immediately.I also didn't get it as I'm more pragmatic about it; I can tolerate some files containing other things as long as the file is small and no one is reusing the code in it.
It's not so much about tolerating it, but more about the fact that it violates the BEM rules, which state that styles of one block should not be present in the files of another block.