Skip to content

Commit

Permalink
Merge pull request #81 from geo-milev/self-host-fonts
Browse files Browse the repository at this point in the history
Self-host fonts
  • Loading branch information
MihailMihov authored Sep 20, 2023
2 parents 1c363c3 + d8fe123 commit 921cbf6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
18 changes: 18 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
},
"type": "module",
"dependencies": {
"@fontsource-variable/roboto-flex": "^5.0.8",
"@fontsource/alegreya": "^5.0.8",
"@fontsource/roboto": "^5.0.8",
"@urql/svelte": "^4.0.1",
"expr-eval": "^2.0.2",
"fuse.js": "^6.6.2",
Expand Down
31 changes: 12 additions & 19 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,19 @@
export let data;
let loaded = false;
onMount(() => {
loaded = true
import('@fontsource/roboto/100.css');
import('@fontsource/roboto/300.css');
import('@fontsource/roboto/400.css');
import('@fontsource/roboto/500.css');
import('@fontsource/roboto/100-italic.css');
import('@fontsource/roboto/300-italic.css');
import('@fontsource/roboto/400-italic.css');
import('@fontsource/roboto/500-italic.css');
import('@fontsource-variable/roboto-flex/opsz.css');
import('@fontsource/alegreya/400.css');
import('@fontsource/alegreya/500.css');
import('@fontsource/alegreya/700.css');
})
seoInfo.set({
Expand Down Expand Up @@ -70,22 +79,6 @@
</script>

<svelte:head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
{#if loaded}
<link
href="https://fonts.googleapis.com/css2?family=Alegreya:wght@400;500;700&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght,[email protected],400,45;8..144,400,50;8..144,1000,0&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700&display=swap"
rel="stylesheet"
/>
{/if}
{#each data.MainInfo.favicons as favicon}
<link rel="icon" type="image/png" sizes="{favicon.size}"
href={env.PUBLIC_SERVER_URL + favicon.favicon.url} />
Expand Down

0 comments on commit 921cbf6

Please sign in to comment.