Skip to content
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

re-add --disable-minification to rustdoc #135353

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/librustdoc/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ pub(crate) struct RenderOptions {
pub(crate) include_parts_dir: Vec<PathToParts>,
/// Where to write crate-info
pub(crate) parts_out_dir: Option<PathToParts>,
/// disable minification of CSS/JS
pub(crate) disable_minification: bool,
}

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -781,6 +783,9 @@ impl Options {

let unstable_features =
rustc_feature::UnstableFeatures::from_environment(crate_name.as_deref());

let disable_minification = matches.opt_present("disable-minification");

let options = Options {
bin_crate,
proc_macro_crate,
Expand Down Expand Up @@ -857,6 +862,7 @@ impl Options {
should_merge,
include_parts_dir,
parts_out_dir,
disable_minification,
};
Some((input, options, render_options))
}
Expand Down
10 changes: 9 additions & 1 deletion src/librustdoc/html/render/write_shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,15 @@ fn write_static_files(
if opt.emit.is_empty() || opt.emit.contains(&EmitType::Toolchain) {
static_files::for_each(|f: &static_files::StaticFile| {
let filename = static_dir.join(f.output_filename());
fs::write(&filename, f.minified()).map_err(|e| PathError::new(e, &filename))
let contents: &[u8];
let contents_vec: Vec<u8>;
if opt.disable_minification {
contents = f.bytes;
} else {
contents_vec = f.minified();
contents = &contents_vec;
};
fs::write(&filename, contents).map_err(|e| PathError::new(e, &filename))
})?;
}

Expand Down
9 changes: 8 additions & 1 deletion src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,15 @@ fn opts() -> Vec<RustcOptGroup> {
"",
"add arguments to be used when compiling doctests",
),
opt(
Unstable,
FlagMulti,
"",
"disable-minification",
"diable the minification of CSS/JS files",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"diable the minification of CSS/JS files",
"disable the minification of CSS/JS files",

"",
),
// deprecated / removed options
opt(Unstable, FlagMulti, "", "disable-minification", "removed", ""),
opt(
Stable,
Multi,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ Options:
--doctest-compilation-args add arguments to be used when compiling doctests

--disable-minification
removed
diable the minification of CSS/JS files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
diable the minification of CSS/JS files
disable the minification of CSS/JS files

--plugin-path DIR
removed, see issue #44136
<https://github.com/rust-lang/rust/issues/44136> for
Expand Down
Loading