Preload Inter font to avoid FOIT on slow connections

This commit is contained in:
Germain Souquet 2021-04-22 12:09:50 +01:00
parent 708f6a26b1
commit 417835fcca
4 changed files with 28 additions and 0 deletions

View file

@ -49,6 +49,15 @@
<link rel="stylesheet" href="<%= file %>">
<% }
} %>
<% for (var i=0; i < htmlWebpackPlugin.tags.headTags.length; i++) {
var tag = htmlWebpackPlugin.tags.headTags[i];
var path = tag.attributes && tag.attributes.href;
if (path.indexOf("Inter") !== -1) { %>
<link rel="preload" as="font" href="<%= path %>" crossorigin="anonymous"/>
<% }
} %>
</head>