SpiriitLabs/vite-plugin-svg-spritemap

Customize Symbol ID / add path name

Closed this issue · 2 comments

hackel commented

I am requesting a way to customize the generated symbol ID so that I can include the preceding path. I have the following directory structure:

icons/
    Add/
        Fill Circle.svg
    Alert/
        Fill Circle.svg

I want to be able to do e.g. <use xlink:href="__spritemap#sprite-Add/Fill%20Circle" />. Otherwise the sprite is full of duplicate symbol IDs and becomes useless. Thank you!

Hi, I need to do some check if I can implement this easily. An alternative could be a svgo plugin but I don't know if it is possible to implement the behavior you want. So I can't promise anything in the near future about this but I keep an eye on.

[EDIT] Maybe we can add an idify option like the spritemap plugin for webpack to let you manage the id of the sprite dynamically?

Hi.
idify not helpful with @hackel scenario :(
Only one svg with same name (but from different subfolder) included in spritemap.

Also, idify affects only symbol ids, but not use and view ids.

P.S.: Tested on windows.