prefix the all id attributes with a string, random or customisable
Author: reveltCreated Jun 5, 2022Updated Jul 16, 2026
Labelsfeature request 🙏
Feature Proposal
Prepend random, set string to each id, so that they're unique per this SVG.
Motivation
When you export multiple SVG from let's say Illustrator, you get same id names, for example #b, #d and so on. They tend to clash, so I have to manually go to the output of svgr and prepend some string to each id value. Can this be automated somehow?
Example
Can we use maybe nanoid or let's say add an input to the GUI sidebar to prepend that string to each id?
Pitch
Because in real-life, more often than not, there will be multiple SVG's on a given page, which, in turn, will have to have unique ids because they're on the same page.
Source: gregberge/svgr