Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6be7902

Browse files
committed
perf: lazy loading of the fonts
1 parent 89d67d6 commit 6be7902

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

index.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<meta name="description" content="libdebug is a Python library to debug binary executables, your own way">
77
<title>libdebug</title>
8-
<link href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap" rel="stylesheet">
8+
<link rel="preconnect" href="https://fonts.googleapis.com">
9+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
910
<style>
1011
body {
1112
display: flex;
@@ -14,7 +15,7 @@
1415
height: 100vh;
1516
margin: 0;
1617
background-color: #ffffef;
17-
font-family: "Nunito", sans-serif;
18+
font-family: "Nunito", Arial, sans-serif;
1819
}
1920
.container {
2021
text-align: center;
@@ -67,6 +68,16 @@
6768
} else {
6869
vertImage.setAttribute("loading", "lazy");
6970
}
71+
72+
var link = document.createElement('link');
73+
link.href = 'https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap';
74+
link.rel = 'stylesheet';
75+
link.type = 'text/css';
76+
document.head.appendChild(link);
77+
78+
link.onload = function() {
79+
document.body.style.fontFamily = '"Nunito", Arial, sans-serif';
80+
};
7081
});
7182
</script>
7283
</head>

0 commit comments

Comments
 (0)