Skip to content

Local fallback for CDN hosted ressources #46

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

Open
3 of 4 tasks
azerupi opened this issue Sep 5, 2015 · 17 comments
Open
3 of 4 tasks

Local fallback for CDN hosted ressources #46

azerupi opened this issue Sep 5, 2015 · 17 comments
Labels
A-CDN Area: Hosted dependencies A-JavaScript Area: Javascript C-papercut Category: A small usability bug

Comments

@azerupi
Copy link
Contributor

azerupi commented Sep 5, 2015

  • Font Awesome
  • Google Fonts (Open Sans) Edit: maybe not that important, other (similar) fonts will be used instead
  • JQuery
  • MathJax

Are loaded from CDN's but should have a local fallback for offline use and for when the CDN is down.

@azerupi azerupi added this to the 0.0.2 milestone Sep 5, 2015
azerupi added a commit that referenced this issue Sep 13, 2015
azerupi added a commit that referenced this issue Sep 13, 2015
@azerupi
Copy link
Contributor Author

azerupi commented Sep 17, 2015

MathJax seems like a lot of files, currently not easily embeddable into the binary (as far as I know)..

JQuery and Font Awesome where the most important ones. I will therefore remove this issue from 0.0.2 milestone. Leave it like this until a better solution is found.

@azerupi azerupi removed this from the 0.0.2 milestone Sep 17, 2015
@Rufflewind
Copy link
Contributor

FYI: MathJax CDN is shutting down. Might want to switch to CDNJS in the meantime.

@infinity0
Copy link

It would be good to add an option to disable remote loading completely. We have all of this stuff in Debian and would ideally just point to the local files. At the moment we have to carry patches in rustc instead.

@infinity0
Copy link

One primary benefit of loading this stuff locally, is that my ISP really doesn't need to know when I'm reading rust documentation. :/

@azerupi
Copy link
Contributor Author

azerupi commented May 15, 2017

@infinity0 You mean when you are reading the docs locally?
Indeed the CDN thing is only an improvement when loading from a remote source. I am not sure how I could differentiate the two use cases though?

@infinity0
Copy link

Perhaps it could read a mdbook.toml file that lets you define alternate local URLs for these resources? Or, get them from an environment variable.

@azerupi
Copy link
Contributor Author

azerupi commented May 15, 2017

Do you want to deactivate the CDN completely everywhere?

@infinity0
Copy link

Yeah, that would be nice. We have them available locally in various subdirectories of /usr/share/fonts and /usr/share/javascript, though I can't speak for other distros.

@azerupi
Copy link
Contributor Author

azerupi commented May 15, 2017

I have made a new issue #271. Feel free to comment there :)

@infinity0
Copy link

Great, thanks!

@anderejd
Copy link

Thanks for working on this issue!

Is there a setting that allows me to deactivate CDN usage? Can I host all dependencies in the build folder?

@reillysiemens
Copy link

I ran into an issue with a poor WiFi connection on the train the other day. The Rust Book was slow to load pages in what I thought was offline mode using rustup doc --book. The cause was the need to load the Google fonts which I did not have cached. When they were downloaded things improved, but the experience before that was frustrating.

I don't know what the size of the font files is and I suspect they're too large to embed in a binary, but I think there's a way to write it so a default browser font is loaded first and the Google font gets used if it's eventually downloaded.

@sysrqb
Copy link

sysrqb commented Jun 11, 2018

I had a very similar problem as @reillysiemens. I was in a situation where I didn't have any internet connectivity. I noticed the page was (roughly) blocked on resolving fonts.googleapis.com, so I added a link-local entry in my /etc/hosts for that domain (so the resolution completed, at least - then the fetch failed quickly). Would treating the fonts.googleapis.com resources in a similar way as the google_analytics be acceptable? With this, I mean can the font.googleapis.com resources be conditionally included using a similar conditional? I'm guessing the page is nicer/prettier when using the Google fonts, but they don't seem to be a requirement.

@jkarneges
Copy link

Just adding my vote for offline support. Hit this yesterday while on the train. I really like how the Rust docs are readable locally and often read them that way, but I hadn't tested this in a truly offline situation until now.

@ehuss ehuss added A-CDN Area: Hosted dependencies and removed A-Infrastructure Area: CI, Releases labels May 17, 2019
@oyvindln
Copy link

oyvindln commented Jul 6, 2019

Would it be possible to add an option when generating that simply disables those external stylesheets so default fonts are used?

@sanmai-NL
Copy link

@oyvindln Fallback of font family is a standard strategy with CSS. So that seems unneeded.

@podsvirov
Copy link

Local fallback for MathJax added in #1918. Review, please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CDN Area: Hosted dependencies A-JavaScript Area: Javascript C-papercut Category: A small usability bug
Projects
None yet
Development

No branches or pull requests