[GH-ISSUE #404] [Request] Consider using root elements with ID's #251

Closed
opened 2026-03-03 14:35:49 +03:00 by kerem · 2 comments
Owner

Originally created by @SaphuA on GitHub (Nov 3, 2017).
Original GitHub issue: https://github.com/lipis/flag-icons/issues/404

I am looking to include a library like this for a project where components are rendered with svg. One of the idea's is to import the flags as needed directly from their svg file. This could be done with the use element. Like so:

<svg class="icon" viewBox="0 0 32 32">
    <use xlink:href="sprites.svg#icon-home" />
</svg>

https://stackoverflow.com/a/22996360/314447

However, this method requires the referenced file sprites.svg to have a (root) element with an id icon-home.

Is this something you'd consider adding? I wouldn't mind creating a pull request for it. It could be as simple as adding id="flag" or id="xx" to all svg elements.

Thanks!

Originally created by @SaphuA on GitHub (Nov 3, 2017). Original GitHub issue: https://github.com/lipis/flag-icons/issues/404 I am looking to include a library like this for a project where components are rendered with svg. One of the idea's is to import the flags as needed directly from their svg file. This could be done with the `use` element. Like so: <svg class="icon" viewBox="0 0 32 32"> <use xlink:href="sprites.svg#icon-home" /> </svg> https://stackoverflow.com/a/22996360/314447 However, this method **requires** the referenced file `sprites.svg` to have a (root) element with an id `icon-home`. Is this something you'd consider adding? I wouldn't mind creating a pull request for it. It could be as simple as adding `id="flag"` or `id="xx"` to all svg elements. Thanks!
kerem closed this issue 2026-03-03 14:35:49 +03:00
Author
Owner

@SaphuA commented on GitHub (Nov 6, 2017):

Went ahead and did it anyway. I wrote a little script that updates all the files so let me know if you need it in another format.

<!-- gh-comment-id:342096838 --> @SaphuA commented on GitHub (Nov 6, 2017): Went ahead and did it anyway. I wrote a little script that updates all the files so let me know if you need it in another format.
Author
Owner

@lipis commented on GitHub (Nov 6, 2017):

fixed

<!-- gh-comment-id:342250824 --> @lipis commented on GitHub (Nov 6, 2017): fixed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/flag-icons#251
No description provided.