patrickxchong / eleventy-plugin-svg-sprite

A high performance Eleventy universal plugin that compiles a directory of SVG files into a single SVG Sprite and adds shortcodes to embed SVG Sprite and SVG content in Eleventy templates.
MIT License
41 stars 6 forks source link

Issue with desc attribute #18

Open saiballo opened 6 months ago

saiballo commented 6 months ago

"I saw in the code that the 'desc' attribute has a random value for the ID. This means that every time I save a page, all the IDs change, and Git shows me many changes to commit. How can I avoid this? Can't we use a static ID based on the name?

Have you any suggestion to solve it?

thank you lorenzo

saiballo commented 6 months ago

Ok... I see the problem. If you remove random ID there is a problem if you use the same image more than once in the page.

Can you add a config option to exclude desc attribute? So the user can decide to use or not to use it without write a custom shortcut

Another solution, maybe better, is to use desc without id (and without aria-labelledby). It's valid because desc is inside svg tag.

No errors in w3c validator without id in desc tag

saiballo commented 6 months ago

any chance to have an option to exclude id and labelledby? current I use this snippet:

`

${nameAttr} icon
            <use xlink:href="#svg-${nameAttr}"></use>
        </svg>`