top | item 12100341

(no title)

ryantownsend | 9 years ago

It's not so much about performance, it's about specificity. To override anything in `.c-button.primary` you'd need something to have equal or greater specificity (meaning you couldn't do `.c-button--large`).

Obviously this is a fairly basic example, but with more chaining comes more levels of specificity which makes for increasingly difficult changes and worse productivity.

discuss

order

kolme|9 years ago

I've done a fair amount of CSS in my time and I have felt the pain, I understand why BEM wants to keep specificity at 1.

One thing bothers me though. Isn't this very WET? You have to repeat the `.primary` rules in every `--primary` thing?

I'm still torn apart about `.button.primary` and `.button--primary`. Also semantic classes vs style bound classes. I'm not completely convinced by any methology.

allendoerfer|9 years ago

I don't get your example.

What's the difference between

    .c-button.primary { … }
    .c-button.large { … }
and

    .c-button--primary { … }
    .c-button--large { … }
?

nilliams|9 years ago

.c-button--primary has lower specificity that .c-button.primary