Description
Right now, light1.52.0.css, dark1.52.0.css, and ayu1.52.0.css are all loaded on each page load. These are early in the page, and as high-priority resources, they loaded first. Even with HTTP/2, they block other resources from starting their downloads (because there appears to be a limit on parallel HTTP/2 fetches made by browsers; though I need to check this).
These stylesheets are loaded like:
<link rel="stylesheet" type="text/css" href="../../light1.52.0.css" id="themeStyle">
<link rel="stylesheet" type="text/css" href="../../dark1.52.0.css" disabled >
<link rel="stylesheet" type="text/css" href="../../ayu1.52.0.css" disabled >
Interestingly, the theme picker JS doesn't change the disabled
property, but changes the href on the main theme:
rust/src/librustdoc/html/static/storage.js
Line 111 in 94736c4
I think it would be more efficient to omit the second two <link>
s, and instead list all the theme URLs using a data
property on rustdoc-vars
.