sampotts/plyr
在 GitHub 查看[Improvement] use BEM in a proper way and make plyr CSS more modular.
Open
#567 创建于 2017年4月24日
Help WantedImprovement
描述
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