BBC-archive / kandl-style-guide

Developer style guide for all BBC Knowledge & Learning products.
https://github.com/bbc/kandl-style-guide
MIT License
3 stars 2 forks source link

Single hyphen not consistent with using BEM #9

Closed randombitsUK closed 9 years ago

randombitsUK commented 9 years ago

"Use single hyphens as word separators in classes and variables, to match the property naming scheme."

If using BEM we'll have double dashes for the modifier part?

stuartmemo commented 9 years ago

Single hyphens are perfectly fine for naming things. For example:

.my-block__my-element--my-modifier {
    ...
}
djmcdonald commented 9 years ago

Are underscores OK to use? If so a scsslint config file with that option turned on would be :astonished:

stuartmemo commented 9 years ago

No, except when you double them with BEM. Sounds like you need to write your own linter. :dancer:

djmcdonald commented 9 years ago

WILSON! :angry:

djmcdonald commented 9 years ago

i've figured it out but i'm not telling you how

stuartmemo commented 9 years ago

Your PRs :eyes:

weejames commented 9 years ago

SCSSlint supports BEM

https://github.com/causes/scss-lint/blob/master/lib/scss_lint/linter/README.md#nameformat

djmcdonald commented 9 years ago

i'm gonna use invisible ink in all my prs from now on

randombitsUK commented 9 years ago

Why is this closed?

The point is was making is the styleguide implies you should only use single hyphens: "Use single hyphens as word separators in classes and variables"

BEM uses double dashes for the modifier in the class name. So surely the styleguide should simply say: "Use hyphens as word separators in classes and variables"

stuartmemo commented 9 years ago

No, this refers to words and variables names, which are single hyphens. The BEM part is different. It's closed because in my opinion it's not worth the time discussing it further.

geoffadams commented 9 years ago

I read this as: "Use hyphens for separating words within a class name, instead of camel-case or underscores."

I don't read it as saying "you can only use single hyphens" or "this is the only way you can use hyphens." That would indeed go against the BEM naming scheme.