Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two SVGs on the same page interfering #102

Open
emptycrown opened this issue Jun 30, 2018 · 6 comments
Open

Two SVGs on the same page interfering #102

emptycrown opened this issue Jun 30, 2018 · 6 comments

Comments

@emptycrown
Copy link

In some cases, when I import two different SVGs onto the same page, their styles interfere, and one image becomes distorted (or there's an extra shadow, etc.).

For example:

import Tree from '-!svg-react-loader!../../images/tree.svg';
import Mountain from '-!svg-react-loader!../../images/mountain.svg';

The components are then rendered inline. Does anyone know how to make sure the SVGs don't interfere with each other?

@SilverFox70
Copy link

Yes! I had the same problem and the underlying cause has to do with the IDs in the SVGs. I have a created a fork of this that solves this problem and is very easy to use. One caveat: if you have two or more SVGs with the same exact name you will still get ID collisions and issues. Check it out here: https://github.com/SilverFox70/svg-react-loader

@ianhowe76
Copy link

I had a similar issue - the fix by @SilverFox70 works for me

@jhamlet
Copy link
Owner

jhamlet commented Oct 15, 2018

@SilverFox70 Do you want to contribute a pull request?

@SilverFox70
Copy link

Hi Jerry, I had meant to submit a PR a while ago but got sidetracked. Let me take a look to see if it needs any cleaning up/commenting and then I'll submit.

@Strangehill
Copy link

In trying to troubleshoot this issue, I reproduced the problem here

Isn't the classIdPrefix query parameter mentioned in the README meant to address just this issue?

@0xferit
Copy link

0xferit commented Oct 30, 2020

Any updates on this? I am having the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants