[1.0.0-beta1] SvgSpriteExtractor XML structure and remote URL

Created on 15 September 2024, 2 months ago
Updated 17 September 2024, about 2 months ago

Problem/Motivation

2 issues

XML markup structure

SvgSpriteExtractor is currently looping on symbols elements as direct children of svg root.

Which is good for icon packs like USWDS:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <symbol id="accessibility_new" viewBox="0 0 24 24">...</symbol>
  <symbol id="accessible_forward" viewBox="0 0 24 24">...</symbol>
  <symbol id="account_balance" viewBox="0 0 24 24">...</symbol>
  ...
</svg>

And bootstrap:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <symbol class="bi bi-0-circle" viewBox="0 0 16 16" id="0-circle">...</symbol>
  <symbol class="bi bi-0-circle-fill" viewBox="0 0 16 16" id="0-circle-fill">..</symbol>
  ...
</svg>

And remix: https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/fonts/re...

However, some icon packs like Icomoon are nesting symbols into a defs element:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1">
<defs>
  <symbol id="icon-home" viewBox="0 0 32 32">... </symbol>
  <symbol id="icon-home2" viewBox="0 0 32 32">...</symbol>
  ...
</defs>
</svg>

Remote retrieval

Because we don't need to scan a folder, this extractor needs to work well also with remote URL like https://raw.githubusercontent.com/Remix-Design/RemixIcon/master/fonts/re...

Let's check.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇫🇷France pdureau Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024