perf(core): move scripts to document head + defer (#8081)

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
This commit is contained in:
Sanjaiyan Parthipan 2022-10-13 19:30:44 +05:30 committed by GitHub
parent 2372335532
commit 80064b2eb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,7 @@ export default `
<link rel="stylesheet" href="<%= it.baseUrl %><%= stylesheet %>" />
<% }); %>
<% it.scripts.forEach((script) => { %>
<link rel="preload" href="<%= it.baseUrl %><%= script %>" as="script">
<script src="<%= it.baseUrl %><%= script %>" defer></script>
<% }); %>
</head>
<body <%~ it.bodyAttributes %>>
@ -27,9 +27,6 @@ export default `
<div id="__docusaurus">
<%~ it.appHtml %>
</div>
<% it.scripts.forEach((script) => { %>
<script src="<%= it.baseUrl %><%= script %>"></script>
<% }); %>
<%~ it.postBodyTags %>
</body>
</html>