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

svg ID collision #98

Open
dhasdiel opened this issue Nov 5, 2023 · 2 comments
Open

svg ID collision #98

dhasdiel opened this issue Nov 5, 2023 · 2 comments

Comments

@dhasdiel
Copy link

dhasdiel commented Nov 5, 2023

When using Vite plugin svgr to import multiple SVG files into a single component, I got a collision of the style because the ids how to handle this?

@piotr-cz
Copy link

piotr-cz commented Dec 6, 2023

This should be fixed after:

  • installing @svgr/plugin-svgo
  • enabling SVGO in plugins options:
    {
      svgrOptions: {
        plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx'],
      }
    }

However, when using single file multiple times, all components still use one single ID.
This is known issue for inline svgs:

See: SVGR Docs > Options > SVGO

@piotr-cz
Copy link

piotr-cz commented Dec 6, 2023

My particular case may be fixed with https://github.com/laleksiunas/inline-svg-unique-id

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

No branches or pull requests

2 participants