File tree 3 files changed +20
-0
lines changed
3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,11 @@ changelog-seen = 2
208
208
# documentation.
209
209
#docs = true
210
210
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
+
211
216
# Indicate whether the compiler should be documented in addition to the standard
212
217
# library and facade crates.
213
218
#compiler-docs = false
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ pub struct Config {
51
51
pub submodules : bool ,
52
52
pub fast_submodules : bool ,
53
53
pub compiler_docs : bool ,
54
+ pub docs_minification : bool ,
54
55
pub docs : bool ,
55
56
pub locked_deps : bool ,
56
57
pub vendor : bool ,
@@ -362,6 +363,7 @@ struct Build {
362
363
rustfmt : Option < PathBuf > ,
363
364
docs : Option < bool > ,
364
365
compiler_docs : Option < bool > ,
366
+ docs_minification : Option < bool > ,
365
367
submodules : Option < bool > ,
366
368
fast_submodules : Option < bool > ,
367
369
gdb : Option < String > ,
@@ -663,6 +665,7 @@ impl Config {
663
665
config. python = build. python . map ( PathBuf :: from) ;
664
666
set ( & mut config. low_priority , build. low_priority ) ;
665
667
set ( & mut config. compiler_docs , build. compiler_docs ) ;
668
+ set ( & mut config. docs_minification , build. docs_minification ) ;
666
669
set ( & mut config. docs , build. docs ) ;
667
670
set ( & mut config. submodules , build. submodules ) ;
668
671
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(
270
270
. arg ( "--markdown-css" )
271
271
. arg ( "../rust.css" ) ;
272
272
273
+ if !builder. config . docs_minification {
274
+ cmd. arg ( "-Z" ) . arg ( "unstable-options" ) . arg ( "--disable-minification" ) ;
275
+ }
276
+
273
277
builder. run ( & mut cmd) ;
274
278
}
275
279
@@ -365,6 +369,10 @@ impl Step for Standalone {
365
369
. arg ( & out)
366
370
. arg ( & path) ;
367
371
372
+ if !builder. config . docs_minification {
373
+ cmd. arg ( "--disable-minification" ) ;
374
+ }
375
+
368
376
if filename == "not_found.md" {
369
377
cmd. arg ( "--markdown-css" ) . arg ( "https://doc.rust-lang.org/rust.css" ) ;
370
378
} else {
@@ -437,6 +445,10 @@ impl Step for Std {
437
445
. arg ( "--index-page" )
438
446
. arg ( & builder. src . join ( "src/doc/index.md" ) ) ;
439
447
448
+ if !builder. config . docs_minification {
449
+ cargo. arg ( "--disable-minification" ) ;
450
+ }
451
+
440
452
builder. run ( & mut cargo. into ( ) ) ;
441
453
} ;
442
454
// Only build the following crates. While we could just iterate over the
You can’t perform that action at this time.
0 commit comments