Skip to content

Commit

Permalink
Optimize font loading
Browse files Browse the repository at this point in the history
  • Loading branch information
krikienoid committed Feb 19, 2023
1 parent 9f39a64 commit 1f6cc83
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
File renamed without changes.
2 changes: 0 additions & 2 deletions src/assets/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* @author krikienoid / https://github.com/krikienoid
*/

@use "fonts";

/*! Custom Spectre.css */

@use "vendors/spectre.css/styles";
Expand Down
14 changes: 13 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,19 @@
<!-- BEGIN Web Font Loader -->
<script type="text/javascript">
(function () {
var PATH_LOCAL_FONT = '@ROOT_URL/assets/css/fonts.css?v=@VERSION';

var sessionStorage = window.sessionStorage;

if (sessionStorage && sessionStorage.wfActive) {
document.documentElement.className += ' wf-active';
(function (d) {
var l = d.createElement('link');
l.rel = 'stylesheet';
l.type = 'text/css';
l.href = PATH_LOCAL_FONT;
d.head.appendChild(l);
d.documentElement.className += ' wf-active';
})(document);

return;
}
Expand All @@ -65,6 +74,9 @@
custom: {
families: [
'Montserrat:n4,n5,n7'
],
urls: [
PATH_LOCAL_FONT
]
},
timeout: 2000,
Expand Down

0 comments on commit 1f6cc83

Please sign in to comment.