Closed AngeloSchulerPiletti closed 1 year ago
Hello, again.
I just forked the repository and noticed it had a dependency with SVGO.
There is nothing to do with this library, everything it's working. But you need to add this configuration to avoid any id
conflict.
vite.config.js
svgLoader({
svgoConfig: {
plugins: [
'prefixIds',
]
}
}),
This plugin works adding prefix IDs and classes with the SVG filename or an arbitrary string which avoid most of the conflicts.
Hello, again.
I just forked the repository and noticed it had a dependency with SVGO.
There is nothing to do with this library, everything it's working. But you need to add this configuration to avoid any
id
conflict.
vite.config.js
svgLoader({ svgoConfig: { plugins: [ 'prefixIds', ] } }),
This plugin works adding prefix IDs and classes with the SVG filename or an arbitrary string which avoid most of the conflicts.
This works for me
Hello, everyone.
I am facing the following issue (which I am still not a 100% sure it's related to
vite-svg-loader
):Context
I have this icon:
But, the code I see on build (on the browser) it's actually:
I am rendering this icon in a Nuxt 3 application inside a dynamic component like this:
Problem
As you can see, the built SVG had its defs
linearGradient
id changed, it causes a conflict with other icons' defs ids and makes thelinearGradient
to not work.How it should be:
How it is:
Nothing is shown because it's transparent instead of the gradient.
What I think can be a solution
I believe that an option to make the
vite-svg-loader
ignore theid
attribute would be great for this.Final words
Again, I am not a 100% sure if this library is the cause of the problem, but I am sure it has to do with the
id
attribute of the SVG.I will try to make a PR, and fix it.
Thank you for your attention