sampotts/plyr
View on GitHub[Improvement] use BEM in a proper way and make plyr CSS more modular.
Open
#567 opened on Apr 24, 2017
Help WantedImprovement
Description
Hey,
It's great that you try to use the BEM methodology in your CSS. But your CSS is not fully compatible with BEM. You use BEM syntax (-- for modifiers and __ for elements) which is good, but there is a lot of nested selectors which is against BEM rules.
For example:
.plyr__controls {
display: flex;
align-items: center;
line-height: 1;
text-align: center;
// Spacing
> button,
.plyr__progress {
// ... code
}
}
This it not a valid BEM syntax.
Because of this sometimes overwriting your styles is problematic - one have to deal with specificity issues.
Istead of nesting you should break your styles into smaller modules. Here's a great article on how to deal with common BEM problems: https://medium.com/fed-or-dead/battling-bem-5-common-problems-and-how-to-avoid-them-5bbd23dee319