sampotts/plyr

[Improvement] use BEM in a proper way and make plyr CSS more modular.

Open

#567 建立於 2017年4月24日

在 GitHub 查看
 (7 留言) (1 反應) (1 負責人)JavaScript (25,318 star) (2,856 fork)batch import
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

貢獻者指南

[Improvement] use BEM in a proper way and make plyr CSS more modular. · sampotts/plyr#567 | Good First Issue