getbem.github.io icon indicating copy to clipboard operation
getbem.github.io copied to clipboard

Correct order of the BEM (naming)

Open luis-pato opened this issue 6 years ago • 7 comments

I have been reading about BEM and i find it really interesting. Concerning the order in the naming convention i have seen two contradictory ideas, so i though i would write you to clear this up. In some places i have seen that in BEM you always have to write block__element--modifier (in this order). In other places i have read we can actually use block--modifier__element. ( i think the example was .person--female__hand).

I can see some reasons for using both, but was wondering what you recommend. Thanks!

luis-pato avatar Nov 22 '18 07:11 luis-pato

According to http://getbem.com/naming/ block__element--modifier is proper. block--modifier__element isn't mentioned.

garybot avatar Feb 16 '19 15:02 garybot

The author is referring to this article https://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/

himedlooff avatar Feb 27 '19 22:02 himedlooff

More info from @iamstarkov https://twitter.com/himedlooff/status/1100887286600945664?s=19

himedlooff avatar Feb 27 '19 23:02 himedlooff

https://en.bem.info/methodology/faq/#why-isnt-the-name-of-the-block-modifier-written-in-the-element-name-block_mod__elem

☝️

BEM.info is against block modifier element

himedlooff avatar Feb 28 '19 02:02 himedlooff

Thanks @himedlooff, i'll take a look at those links!

luis-pato avatar Mar 04 '19 07:03 luis-pato

@luis-pato https://en.bem.info/methodology/naming-convention/#alternative-naming-schemes

rokumatsumoto avatar Jun 19 '19 09:06 rokumatsumoto

@rokumatsumoto thanks, i'll take a look! 😄

luis-pato avatar Jun 19 '19 09:06 luis-pato