This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,11 @@ changelog-seen = 2
208208# documentation.
209209# docs = true
210210
211+ # Flag to specify whether CSS, JavaScript, and HTML are minified when
212+ # docs are generated. JSON is always minified, because it's enormous,
213+ # and generated in already-minified form from the beginning.
214+ # docs-minification = true
215+
211216# Indicate whether the compiler should be documented in addition to the standard
212217# library and facade crates.
213218# compiler-docs = false
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ pub struct Config {
5151 pub submodules : bool ,
5252 pub fast_submodules : bool ,
5353 pub compiler_docs : bool ,
54+ pub docs_minification : bool ,
5455 pub docs : bool ,
5556 pub locked_deps : bool ,
5657 pub vendor : bool ,
@@ -362,6 +363,7 @@ struct Build {
362363 rustfmt : Option < PathBuf > ,
363364 docs : Option < bool > ,
364365 compiler_docs : Option < bool > ,
366+ docs_minification : Option < bool > ,
365367 submodules : Option < bool > ,
366368 fast_submodules : Option < bool > ,
367369 gdb : Option < String > ,
@@ -663,6 +665,7 @@ impl Config {
663665 config. python = build. python . map ( PathBuf :: from) ;
664666 set ( & mut config. low_priority , build. low_priority ) ;
665667 set ( & mut config. compiler_docs , build. compiler_docs ) ;
668+ set ( & mut config. docs_minification , build. docs_minification ) ;
666669 set ( & mut config. docs , build. docs ) ;
667670 set ( & mut config. submodules , build. submodules ) ;
668671 set ( & mut config. fast_submodules , build. fast_submodules ) ;
Original file line number Diff line number Diff line change @@ -270,6 +270,10 @@ fn invoke_rustdoc(
270270 . arg ( "--markdown-css" )
271271 . arg ( "../rust.css" ) ;
272272
273+ if !builder. config . docs_minification {
274+ cmd. arg ( "-Z" ) . arg ( "unstable-options" ) . arg ( "--disable-minification" ) ;
275+ }
276+
273277 builder. run ( & mut cmd) ;
274278}
275279
@@ -365,6 +369,10 @@ impl Step for Standalone {
365369 . arg ( & out)
366370 . arg ( & path) ;
367371
372+ if !builder. config . docs_minification {
373+ cmd. arg ( "--disable-minification" ) ;
374+ }
375+
368376 if filename == "not_found.md" {
369377 cmd. arg ( "--markdown-css" ) . arg ( "https://doc.rust-lang.org/rust.css" ) ;
370378 } else {
@@ -437,6 +445,10 @@ impl Step for Std {
437445 . arg ( "--index-page" )
438446 . arg ( & builder. src . join ( "src/doc/index.md" ) ) ;
439447
448+ if !builder. config . docs_minification {
449+ cargo. arg ( "--disable-minification" ) ;
450+ }
451+
440452 builder. run ( & mut cargo. into ( ) ) ;
441453 } ;
442454 // Only build the following crates. While we could just iterate over the
You can’t perform that action at this time.
0 commit comments