templates/layout.html: add preload links for CSS resources

Tell to browsers the resources we will need, as soon as possible. This
means they do not need to fully download our CSS to know what they
should load next.

For some reason, crossorigin is required on fonts to avoid them being
loaded twice by Firefox.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
This commit is contained in:
Théo Lebrun 2024-11-06 15:01:32 +01:00
parent 6356cdc3c7
commit 41de913669

View file

@ -17,6 +17,14 @@
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1" />
<link rel="stylesheet" href="/static/style.css?v=13">
<link rel="preload" href="/static/img/2penguins.svg" as="image" />
<link rel="preload" href="/static/img/arrow-dropdown-16.svg" as="image" />
<link rel="preload" crossorigin href="/static/fonts/lxr.ttf" as="font" />
<link rel="preload" crossorigin href="/static/fonts/ubuntu/ubuntu-v14-cyrillic_greek_latin_latin-ext_greek-ext_cyrillic-ext-regular.woff2" as="font" />
<link rel="preload" crossorigin href="/static/fonts/ubuntu/ubuntu-v14-cyrillic_greek_latin_latin-ext_greek-ext_cyrillic-ext-700.woff2" as="font" />
<link rel="preload" crossorigin href="/static/fonts/ubuntu/ubuntu-v14-cyrillic_greek_latin_latin-ext_greek-ext_cyrillic-ext-italic.woff2" as="font" />
<script>
document.documentElement.classList.remove('no-js');
document.documentElement.classList.add('js');