robhrt7 / MCSS

[Frozen] Multilayer CSS organization methodology
http://operatino.github.io/MCSS/
312 stars 43 forks source link

A bit cleaner short modifiers naming #13

Closed borodean closed 8 years ago

borodean commented 10 years ago

MCSS allows two different notations for modifiers:

.block__modifier {} /* the long one */
.__modifier {} /* the sort one, usable if one's dropping IE6 support */

In the short one double underscore __ is used, which seems to originate from the long notation. However, I thought that the single underscore _ at the beginning of the name is enough to distinguish modifiers from another kinds of classes and looks a bit cleaner:

._modifier {}
XOP commented 10 years ago

Hi, borodean! It may seem cleaner at first glance, however it looks more confusing in production code. See - single underscore used with descendant classes, i.e. ".parent_child", so it doesn't fit with "_modifier" naming. There are some methodologies, using inverse naming logic, however MCSS used to stick with present one.

robhrt7 commented 10 years ago

MCSS doesn't force everyone to use specific naming syntax, the main part is about sticking to common rules and separate different types of selectors, blocks ant etc. There are other naming conventions that could be used with MCSS. like:

.block__element
.block__element_mod

.block_element
.block_elemennt--mod

We need to leave something easy noticeable to put the focus on blocks modifiers. As they're used not so often highlighting them with double underscore won't affect overall cleanliness of the code in most cases.