Skip to content

Commit 80f5f60

Browse files
committed
Auto merge of rust-lang#90872 - ken-matsui:add-defer-to-rustdoc-template, r=jsha
Move `scripts` on the rustdoc template into `head` and apply the `defer` attribute Closes rust-lang#90719
2 parents f7c4829 + 88787a3 commit 80f5f60

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/librustdoc/html/templates/page.html

+10-10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
></script> {#- -#}
2121
<script src="{{static_root_path | safe}}storage{{page.resource_suffix}}.js"></script> {#- -#}
2222
<script src="{{page.root_path | safe}}crates{{page.resource_suffix}}.js"></script> {#- -#}
23+
<script defer src="{{static_root_path | safe}}main{{page.resource_suffix}}.js"></script> {#- -#}
24+
{%- for script in page.static_extra_scripts -%}
25+
<script defer src="{{static_root_path | safe}}{{script}}.js"></script> {#- -#}
26+
{% endfor %}
27+
{%- if layout.scrape_examples_extension -%}
28+
<script defer src="{{page.root_path | safe}}scrape-examples{{page.resource_suffix}}.js"></script> {#- -#}
29+
{%- endif -%}
30+
{%- for script in page.extra_scripts -%}
31+
<script defer src="{{page.root_path | safe}}{{script}}.js"></script> {#- -#}
32+
{% endfor %}
2333
<noscript> {#- -#}
2434
<link rel="stylesheet" {# -#}
2535
href="{{static_root_path | safe}}noscript{{page.resource_suffix}}.css"> {#- -#}
@@ -107,15 +117,5 @@
107117
data-search-index-js="{{page.root_path | safe}}search-index{{page.resource_suffix}}.js" {# -#}
108118
data-search-js="{{static_root_path | safe}}search{{page.resource_suffix}}.js"> {#- -#}
109119
</div>
110-
<script src="{{static_root_path | safe}}main{{page.resource_suffix}}.js"></script> {#- -#}
111-
{%- for script in page.static_extra_scripts -%}
112-
<script src="{{static_root_path | safe}}{{script}}.js"></script> {#- -#}
113-
{% endfor %}
114-
{%- if layout.scrape_examples_extension -%}
115-
<script src="{{page.root_path | safe}}scrape-examples{{page.resource_suffix}}.js"></script> {#- -#}
116-
{%- endif -%}
117-
{%- for script in page.extra_scripts -%}
118-
<script src="{{page.root_path | safe}}{{script}}.js"></script> {#- -#}
119-
{% endfor %}
120120
</body> {#- -#}
121121
</html> {#- -#}

0 commit comments

Comments
 (0)