-
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved font loading method for better performance
- Loading branch information
1 parent
9a2f77a
commit e860b01
Showing
8 changed files
with
74 additions
and
46 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{!-- Sans-serif font is always loaded, because it's the default font for some part of the theme regardless of the settings --}} | ||
{{> "fonts/sans"}} | ||
|
||
{{#match @custom.title_font "Modern sans-serif"}} | ||
{{#match @custom.body_font "Elegant serif"}} | ||
{{> "fonts/serif"}} | ||
{{/match}} | ||
{{else match @custom.title_font "Elegant serif"}} | ||
{{> "fonts/serif"}} | ||
{{else}} | ||
{{> "fonts/mono"}} | ||
{{#match @custom.body_font "Elegant serif"}} | ||
{{> "fonts/serif"}} | ||
{{/match}} | ||
{{/match}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<link rel="preload" as="font" type="font/woff2" href="{{asset "fonts/jetbrains-mono-roman.woff2"}}" crossorigin="anonymous"> | ||
<link rel="preload" as="font" type="font/woff2" href="{{asset "fonts/jetbrains-mono-italic.woff2"}}" crossorigin="anonymous"> | ||
<style> | ||
@font-face { | ||
font-family: "JetBrains Mono"; | ||
font-style: normal; | ||
font-weight: 100 800; | ||
font-display: optional; | ||
src: url({{asset "fonts/jetbrains-mono-roman.woff2"}}) format("woff2"); | ||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; | ||
} | ||
@font-face { | ||
font-family: "JetBrains Mono"; | ||
font-style: italic; | ||
font-weight: 100 800; | ||
font-display: optional; | ||
src: url({{asset "fonts/jetbrains-mono-italic.woff2"}}) format("woff2"); | ||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<link rel="preload" as="font" type="font/woff2" href="{{asset "fonts/inter-roman.woff2"}}" crossorigin="anonymous"> | ||
<style> | ||
@font-face { | ||
font-family: "Inter"; | ||
font-style: normal; | ||
font-weight: 100 900; | ||
font-display: optional; | ||
src: url({{asset "fonts/inter-roman.woff2"}}) format("woff2"); | ||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<link rel="preload" as="font" type="font/woff2" href="{{asset "fonts/eb-garamond-roman.woff2"}}" crossorigin="anonymous"> | ||
<link rel="preload" as="font" type="font/woff2" href="{{asset "fonts/eb-garamond-italic.woff2"}}" crossorigin="anonymous"> | ||
<style> | ||
@font-face { | ||
font-family: "EB Garamond"; | ||
font-style: normal; | ||
font-weight: 400 800; | ||
font-display: optional; | ||
src: url({{asset "fonts/eb-garamond-roman.woff2"}}) format("woff2"); | ||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; | ||
} | ||
@font-face { | ||
font-family: "EB Garamond"; | ||
font-style: italic; | ||
font-weight: 400 800; | ||
font-display: optional; | ||
src: url({{asset "fonts/eb-garamond-italic.woff2"}}) format("woff2"); | ||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; | ||
} | ||
</style> |