Add `build.static-files-dir` config option
This PR adds support for a new build.static-files-dir config option. It only targets static files, not custom ones. The goal is, when rustdoc officially supports to generate mdbook alongside the API docs, to make this integration easier for docs.rs:
- To prevent static files duplication.
- To prevent needing to rewrite URLs like we do with rustdoc files.
I tested this feature locally with:
diff --git a/test_book/book.toml b/test_book/book.toml
index 854b5e7d3..ad5b183af 100644
--- a/test_book/book.toml
+++ b/test_book/book.toml
@@ -7,6 +7,9 @@ language = "en"
[rust]
edition = "2018"
+[build]
+static-files-dir = "/tmp/static"
+
[output.html]
mathjax-support = true
hash-files = true
It's working as expected, files were generated in /tmp/static and URLs were pointing to this folder.
Now, some questions: what would be the best way to test it in a unit test?
And finally: @syphar, would it be ok for docs.rs (speaking hypothetically for something that hopefully will be supported by rustdoc in the future) to use this new static folder option to generate static files directly in a /-/mdbook folder (since we use docker, I suppose we can cheat by creating a /- folder in any case)? Like that the URLs are already all valid so no need to update them when serving the book files and files are hashed.
:umbrella: The latest upstream changes (possibly 21f2435182e4a80c0bd0e3184ce36f7a57529d08) made this pull request unmergeable. Please resolve the merge conflicts.