Skip to content
New issue

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

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

Already on GitHub? # to your account

Provide a way to change path of common css/js paths in documentations #48094

Closed
onur opened this issue Feb 9, 2018 · 8 comments
Closed

Provide a way to change path of common css/js paths in documentations #48094

onur opened this issue Feb 9, 2018 · 8 comments
Assignees
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@onur
Copy link
Member

onur commented Feb 9, 2018

I am asking this for docs.rs.

Currently docs.rs is leveraging browser cache by serving every common css/js file ("rustdoc.css", "main.css", "main.js", "normalize.css", "*.woff"]) from root of the docs.rs. Otherwise docs.rs would serve 60k different copies of this files since rustdoc is generating them for each crate. Docs.rs is only replacing this file paths in documentations to provide a better/faster browsing experience.

But unfortunately new theme picker did break this feature and causing me some trouble to update rustc on docs.rs since it's not compatible.

I did a small talk with @GuillaumeGomez (the guy behind theme picker). He came up with an idea of adding a --replace or --url argument to rustdoc so this files can be served from a desired path. For example running rustdoc lib.rs --url main.css /main-1.24.css --url light.css /light-1.24.css will replace this paths for the main.css and light.css.

This will make new theme picker compatible with docs.rs and also it will dramatically improve docs.rs by removing only necessary documentation change made by docs.rs.

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Feb 9, 2018

The alternative with --replace is as follow:

rustdoc lib.rs --replace main.css ../../main-1.24.css

@QuietMisdreavus
Copy link
Member

How about we add a hook for the entire html/static/ folder at once? That way, instead of having to hook each file individually, we can just dump those files into that folder (or assume you have it there) instead of putting them in the doc root every time.

@GuillaumeGomez
Copy link
Member

It could as well. I don't have preference in here.

@pietroalbini pietroalbini added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-dev-tools-rustdoc labels Feb 10, 2018
@GuillaumeGomez
Copy link
Member

Another idea: --files-suffix="something which generates rustdoc-something.css.

@GuillaumeGomez
Copy link
Member

The best option for the moment seems to be the one proposed by @QuietMisdreavus. We just need confirmation from @onur now.

@onur
Copy link
Member Author

onur commented Feb 21, 2018

@GuillaumeGomez --files-suffix might not work, I am not just adding a suffix to common files. I am also moving them to out of target/doc directory. @QuietMisdreavus idea is great, a hook would solve this problem for me.

@GuillaumeGomez
Copy link
Member

Then I'll implement @QuietMisdreavus' solution.

@GuillaumeGomez GuillaumeGomez self-assigned this Feb 21, 2018
@onur
Copy link
Member Author

onur commented Mar 29, 2018

#48511 fixed this issue

@onur onur closed this as completed Mar 29, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants