PERF: Move `preload` hints to the `<head>` (#15008)
We have two JS assets which are included in the `<body>` of responses. We were including the `<link rel='preload'` hint alongside the script tag in the body. Instead, we can move the preload hint to the `<head>` so that the browser discovers it earlier, and can start preloading the assets while the body is loading.
This commit is contained in:
parent
510219a0da
commit
ed2c3ebd71
|
@ -21,6 +21,8 @@
|
|||
|
||||
<%= build_plugin_html 'server:before-script-load' %>
|
||||
|
||||
<link rel="preload" href="<%= script_asset_path "start-discourse" %>" as="script">
|
||||
<link rel="preload" href="<%= script_asset_path "browser-update" %>" as="script">
|
||||
<%= preload_script 'browser-detect' %>
|
||||
|
||||
<%= preload_script "locales/#{I18n.locale}" %>
|
||||
|
@ -113,11 +115,12 @@
|
|||
<% end %>
|
||||
|
||||
<div class="hidden" id="data-preloaded" data-preloaded="<%= preloaded_json %>"></div>
|
||||
<%= preload_script "start-discourse" %>
|
||||
|
||||
<script src="<%= script_asset_path "start-discourse" %>"></script>
|
||||
|
||||
<%= yield :data %>
|
||||
|
||||
<%= preload_script 'browser-update' %>
|
||||
<script src="<%= script_asset_path "browser-update" %>"></script>
|
||||
|
||||
<%- unless customization_disabled? %>
|
||||
<%= theme_lookup("body_tag") %>
|
||||
|
|
Loading…
Reference in New Issue