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.

add setting to stop module change class names to BEM style

See original GitHub issue

🚀 Feature Proposal

its simple. in my svg file I have:

<g class="rejected-badge"></g>

but in my output I get this:

<g class="MyIconNameComponent__rejected-badge"></g>

could you add option to compile time like native option so I can set it to not modify my class name to BEM style.

Motivation

I have multiple icon with common class names and I want to add some general style in css file for them

Example

{
   test: /\.svg/,
    use: [
      {
            loader: '@svgr/webpack',
            options: {
              bem: false,
            },
        },
     ],
},

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
zeorincommented, Sep 17, 2021

I came across this same issue when migrating a site from Create React App to Next.js. CRA bundles SVGR in its Webpack setup, whilst Next.js doesn’t. CRA doesn’t rewrite the ids in SVGs loaded this way, so I had a look at their code, and setting it up like that works (ids are not re-written): https://github.com/facebook/create-react-app/blob/main/packages/react-scripts/config/webpack.config.js#L364-L377

0reactions
Grsmtocommented, Oct 4, 2021

.svgo.yml

plugins:
  - prefixIds: false
Read more comments on GitHub >

github_iconTop Results From Across the Web

Battling BEM CSS: 10 Common Problems And How To Avoid ...
I believe the double-underscore pattern should appear only once in a selector name. BEM stands for Block__Element–Modifier , not Block__Element ...
Read more >
BEM 101 - CSS-Tricks
This is done by appending two hyphens to the name of the block just like btn--orange .
Read more >
Naming - BEM
Add modifier classes only to blocks/elements they modify, and keep the original class. Use modifier class name as selector: .block--hidden { } To...
Read more >
Using BEM conventions in CSS modules leveraging custom ...
To style our React components we use CSS modules and BEM. There is a nuisance that can be fixed leveraging custom webpack loaders....
Read more >
How to Use BEM Methodology - Toptal
If you ever saw a class name like header__form--search , that is BEM in action ... Also, if you want to break your...
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