question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BEM 💩 👎

<div class="mdc-layout-grid">
  <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-6 mdc-layout-grid__cell--span-8-tablet"></div>
</div>

RSCSS 👀 👍

<div class="mdc-grid">
  <div class="cell -span-6 -span-8-tablet"></div>
</div>

http://rscss.io

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kfranqueirocommented, Aug 28, 2017

As @Garbee explained, this was a conscious design decision by the material-components-web team. While BEM classnames are admittedly more verbose, they greatly reduce the chance of conflict when used together with other third-party libraries as well as your own styles, and also promote lower specificity selectors in general.

In contrast, using the RSCSS example above, it’d be very easy for multiple libraries or your own code to coincidentally define styles for the same selector (e.g., .cell) and end up in conflict with each other. It also seems to advocate nesting selectors to a higher degree, which has the potential to cause additional difficulties when the need arises to override styles.

Avoiding conflicts and difficulties with other code is crucial for a library like MDC Web, which is designed to be usable regardless of what other JS or CSS frameworks you may also be using. We appreciate the suggestion, but in this particular case, we have strong reasons for having chosen BEM.

1reaction
Garbeecommented, Aug 26, 2017

RSCSS due to having non-namespaced classes internally can lead to collisions with external code that could be pulled in. BEM was a specific design choice for the API since it namespaces everything provided into isolated components that have the least chance for external collisions.

If you’d like to use an RSCSS setup in your app, you have Sass available to write your own API layer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rewrite assets paths in CSS/SASS/SCSS in webpack
I tried using resolve-url-loader but it doesn't do anything. How do I get urls to be rewritten to the right path? css ·...
Read more >
Frontend recipes RSCSS | Mashup Garage Playbook
Good thing we follow a great CSS practice called RSCSS. ... They are usually used to change the look and behaviour of the...
Read more >
CSS URL Rewriting | Laravel Mix Documentation
One key concept to understand is that Mix and webpack will rewrite any url() s ... mix.sass('src/app.scss', 'dist', { // Rewrite CSS urls...
Read more >
broken scss url rewrites with scss variables #5337 - vitejs/vite
Describe the bug When an imported scss file has variable url($foo) links, they get badly rewritten: scss-import-test/index.scss: $default-image-1: ...
Read more >
Sass, SCSS, and Less | WebStorm Documentation - JetBrains
Compiling SCSS into CSS: creating a File Watcher ... Let's change grid.scss, for example, replace margin-left: 0; at line 31 with ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found