question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

prefix the all id attributes with a string, random or customisable

See original GitHub issue

🚀 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.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:6
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
matthew-deancommented, Sep 12, 2022

@AlfieJones That’s a good start but it only updates the ID for clipPath. URL references for masks, for example, would not work.

0reactions
stale[bot]commented, Nov 13, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to apply the css on all ID starting with [duplicate]
One way to achieve what you are looking for in pure CSS is with an attribute prefix selector (which uses a form of...
Read more >
How to Implement a Custom, Sequence-Based ID Generator
A lot of applications use IDs that are based on a sequence but use an additional prefix. You can easily support these IDs...
Read more >
String claims transformations - Azure AD B2C - Microsoft Learn
String claims transformation examples for the Identity Experience Framework ... Creates a random string using the random number generator.
Read more >
Tools attributes reference | Android Studio
Android Studio supports a variety of XML attributes in the tools ... menu IDs, separated by commas (without @menu/ or any such ID...
Read more >
Prisma schema API (Reference)
Name, Required, Type, Description. provider, Yes, String ( postgresql , mysql , sqlite , sqlserver , mongodb , cockroachdb ), Describes which data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found