Skip to content

Inline some SVG icons into rustdoc.css #91724

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

Closed
wants to merge 2 commits into from

Conversation

notriddle
Copy link
Contributor

This reduces the number of requests made when loading rustdoc off the web, without significant bloat (they aren't base64-ed, and they aren't inlined into every single HTML file, either).

This is currently three icons, but if we switch to font-awesome, it will probably be more.

This reduces the number of requests made when loading rustdoc off the web,
without any significant bloat (they aren't base64-ed, and they aren't inlined
into every single HTML file, either).

This is currently three icons, but if we switch to font-awesome, it will
probably be more.
@rust-highfive
Copy link
Contributor

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez

@rust-highfive
Copy link
Contributor

r? @CraftSpider

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 9, 2021
@GuillaumeGomez
Copy link
Member

It looks great. I'll take a complete look in the next days to be sure I don't miss something.

r? @GuillaumeGomez

@camelid camelid added A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 10, 2021
@GuillaumeGomez
Copy link
Member

This is really great, thanks a lot!

@bors: r+

@bors
Copy link
Collaborator

bors commented Dec 12, 2021

📌 Commit 04b96ac has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 12, 2021
// The following icons are embeded in the CSS file,
// unless we're in tweak-the-theme-mode.
if !options.enable_minification {
write_toolchain("down-arrow.svg", static_files::DOWN_ARROW_SVG)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized but: could you merge the write_toolchain call with the css_icon_url closure call please? It would make it impossible to forget to update this part.

@GuillaumeGomez
Copy link
Member

@bors: r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 12, 2021
@GuillaumeGomez
Copy link
Member

Another thing I wonder is if this PR is useful considering #91735.

@notriddle
Copy link
Contributor Author

Another thing I wonder is if this PR is useful considering #91735.

That’s actually the main reason for doing this. It adds more SVG icons, in places that used to use Unicode symbols, so it makes sense to put in work to reduce the number of separate network requests.

@GuillaumeGomez
Copy link
Member

The PR I linked moves all icons them into a font. So it reduces the number of calls, not the opposite.

@notriddle notriddle closed this Dec 14, 2021
@notriddle notriddle deleted the notriddle/opt-svg branch December 14, 2021 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants