sampotts/plyr

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

Open

#567 opened on Apr 24, 2017

View on GitHub
 (7 comments) (1 reaction) (1 assignee)JavaScript (25,318 stars) (2,856 forks)batch import
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

Contributor guide