-
Notifications
You must be signed in to change notification settings - Fork 210
Switch fontawesome from font files to embedded SVG #1033
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
Conversation
9196a2c
to
cdf6b78
Compare
Can you post some screenshots of what this looks like after the change? I'm a little worried about changing so much of the CSS without any frontend tests ... |
cc @Kixiron This is great! I'm wondering, could we inline the SVG directly without having to download the |
To be clear, landing this is also fine, if you don't have the time to make the other change or you prefer to do it in a followup :) |
Yeah, we probably should switch to inlined SVG. I didn't originally do it, because there's no FontAwesome HOWTO for it, but I've done it before and know how. Also, IE11 shows blank spots where the icons ought to be, and inlining them would fix that. |
29ae43f
to
47f2484
Compare
Okay, it embeds the SVG directly now. It looks identical. |
It looks like you moved all the vendor files into a new repo, which you just published as a crate? https://github.com/notriddle/font-awesome-as-a-crate What's the rationale for doing that? What's the long-term maintenance plan if we need to update? I want to avoid adding and deleting 8k lines of code every 2 weeks. |
Yes.
font-awesome-as-a-crate doesn't just vendor the SVG files. It concatenates them into a massive rust source file. The rationale for embedding the SVG files directly in your binary:
The rationale for doing it in its own crate:
I give everyone on the docs.rs team write access to the font-awesome-as-a-crate repository. But, more generally, I don't actually expect the vendored fontawesome to be updated very often. I know it's happened a couple of times in the last few weeks, but that probably isn't normal. docs.rs used the same fontawesome version for years without upgrading and it was fine. The way it's now being tweaked twice in the same month is an unusual circumstance. |
All your points make sense, except that I'm a little unsure about having font_awesome_as_a_crate in a separate repository, since we're the only ones currently using it. Do you mind making it part of the docs.rs workspace and adding I and @pietroalbini as owners on crates.io? See #1000 for an example of what that would look like. |
Sure, let's do that. |
ba01450
to
b70cec5
Compare
Did you get my invite on crates.io? |
Got it, thanks. Don't have time to do a full review of this right now but the general idea looks right. Thanks for working on this! |
ab5fe2f
to
a62f553
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once #1041 unblocks switching vendor/fontawesome
to crates/fontawesome
Can you rebase this over master and change the new crate to be in |
Fixes rust-lang#790 The rationale for embedding the SVG files directly in the binary: * avoid file I/O occurring in your Tera Filter, which would likely have complex knock-on effects when combined with `async` * avoid complex error handling in your Tera Filter, which is the inevitable outcome of file I/O * avoid having to carefully construct filesystem paths, with all the terrible possible outcomes and failure modes that come with that (using the infrastructure that the existing static file server uses is not an option, because it's not an HTTP request) * I'm guessing it's faster to pull a string out of the binary's text section than it is to open a file for every request, though I have done no benchmarking to justify this wild speculation The rationale for doing it in its own crate: * we're not using any of docs.rs's file handling infrastructure anyway, so all the other stuff in its build.rs was just getting in the way while I coded up its codegen script * it should be useful in other Rust web projects, regardless of the web framework they're using * let's not force rustc to parse a 1.3MiB source file every time you change docs.rs; this seems like prime "separate translation unit" material
d1cf1c9
to
8d60463
Compare
@rustbot modify labels to -S-waiting-on-author, +S-waiting-on-review |
Error: This repository is not enabled to use triagebot. Please let |
shucks |
I'd take a PR adding triagebot ;) |
Thanks for the PR! |
Fixes #790