8000 Use SVG spritesheet to speed up page loads · Issue #128 · Sv443/BetterYTM · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Use SVG spritesheet to speed up page loads #128
Open
@Sv443

Description

@Sv443

Even though all SVG icons are loaded from the cache 99% of the time, running like 50 consecutive fetch()es still takes a long time as each request has tons of overhead when being constructed.
This means the config menu currently takes a few seconds to open and the rest of the page is also slowed down (because of the icons in the song queue for example).

In a pre-build step the SVGs could all be combined into a sprite bundle like this:

<svg id="bytm-icons-container" xmlns="http://www.w3.org/2000/svg" style="display: none;" inert="true">
  <symbol id="bytm-icon-foo" viewBox="0 0 24 24">
    <!-- SVG content for foo -->
  </symbol>
  <symbol id="bytm-icon-bar" viewBox="0 0 24 24">
    <!-- SVG content for bar -->
  </symbol>
  <!-- ... -->
</svg>

...and then fetched once and added into the body at initialization time.
Then icon elements can be created like this:

<svg>
  <use xlink:href="#bytm-icon-foo"></use>
</svg>

Metadata

Metadata

Assignees

Labels

E3 🔴Highest level of required effort and potential complicationsenhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0