Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use React svg components for regularly used icons #5865

Open
1 of 2 tasks
slorber opened this issue Nov 3, 2021 · 3 comments
Open
1 of 2 tasks

Do not use React svg components for regularly used icons #5865

slorber opened this issue Nov 3, 2021 · 3 comments
Labels
domain: performance Related to bundle size or perf optimization proposal This issue is a proposal, usually non-trivial change

Comments

@slorber
Copy link
Collaborator

slorber commented Nov 3, 2021

Have you read the Contributing Guidelines on issues?

Motivation

This issue about updating the number of visible archived versions in the version dropdown lead to a weird build size diff on HTML files:

#5862 (comment)

The diff in size is due to using an inlined SVG component for external links 😅 the SVG markup is duplicated in the HTML file for each item

image

For reusable icons of our theme, we should rather require an svg file instead of using a React SVG component, to reduce HTML output size.

It can have a significant impact on pages with a lot of icons (due to navbar, footer, doc sidebar...)

Self-service

  • I'd be willing to do some initial work on this proposal myself.
@slorber
Copy link
Collaborator Author

slorber commented Dec 1, 2021

Interesting discussion related to this problem: https://twitter.com/_developit/status/1382838799420514317

@slorber
Copy link
Collaborator Author

slorber commented Feb 8, 2022

svg sprites look like a good solution: https://benadam.me/thoughts/react-svg-sprites/

@Josh-Cena Josh-Cena added the domain: performance Related to bundle size or perf optimization label Mar 29, 2022
@slorber
Copy link
Collaborator Author

slorber commented Sep 2, 2024

Related read: https://fotis.xyz/posts/introducing-svg-use/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: performance Related to bundle size or perf optimization proposal This issue is a proposal, usually non-trivial change
Projects
None yet
Development

No branches or pull requests

2 participants