about summary refs log tree commit diff
path: root/src/librustdoc/html/render/write_shared.rs
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2021-03-31 17:23:32 -0400
committerJoshua Nelson <jyn514@gmail.com>2021-03-31 17:24:27 -0400
commit413938d7a9df4efe800552fa03ce1a5866539cbc (patch)
tree3d2e8800940f602c8962089b24de8c26a65a6d23 /src/librustdoc/html/render/write_shared.rs
parent1086d9b7b58fea8f15b1f10bc2e527b6fcb0e382 (diff)
downloadrust-413938d7a9df4efe800552fa03ce1a5866539cbc.tar.gz
rust-413938d7a9df4efe800552fa03ce1a5866539cbc.zip
Fix `--external-css` to be invocation-specific and note main.js should be invocation specific
Diffstat (limited to 'src/librustdoc/html/render/write_shared.rs')
-rw-r--r--src/librustdoc/html/render/write_shared.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs
index 34994097812..b2f2283c177 100644
--- a/src/librustdoc/html/render/write_shared.rs
+++ b/src/librustdoc/html/render/write_shared.rs
@@ -213,6 +213,9 @@ pub(super) fn write_shared(
     let mut themes: Vec<&String> = themes.iter().collect();
     themes.sort();
 
+    // FIXME: this should probably not be a toolchain file since it depends on `--theme`.
+    // But it seems a shame to copy it over and over when it's almost always the same.
+    // Maybe we can change the representation to move this out of main.js?
     write_minify(
         "main.js",
         &static_files::MAIN_JS.replace(
@@ -238,7 +241,13 @@ pub(super) fn write_shared(
 
     if let Some(ref css) = cx.shared.layout.css_file_extension {
         let buffer = try_err!(fs::read_to_string(css), css);
-        write_minify("theme.css", &buffer)?;
+        // This varies based on the invocation, so it can't go through the write_minify wrapper.
+        cx.write_minify(
+            SharedResource::InvocationSpecific { basename: "theme.css" },
+            &buffer,
+            options.enable_minification,
+            &options.emit,
+        )?;
     }
     write_minify("normalize.css", static_files::NORMALIZE_CSS)?;
     for (name, contents) in &*FILES_UNVERSIONED {