Skip to content

Commit a52d357

Browse files
chore: use astro's native font loading
Signed-off-by: Henry <mail@henrygressmann.de>
1 parent 8560bd2 commit a52d357

7 files changed

Lines changed: 16 additions & 9 deletions

File tree

‎data/licenses-cargo.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎data/licenses-npm.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎web/astro.config.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from "node:path";
22
import react from "@astrojs/react";
33
import type { AstroIntegration } from "astro";
4-
import { defineConfig } from "astro/config";
4+
import { defineConfig, fontProviders } from "astro/config";
55
import license from "rollup-plugin-license";
66

77
const dirname = path.dirname(new URL(import.meta.url).pathname);
@@ -38,6 +38,16 @@ function setPrerender(): AstroIntegration {
3838

3939
// https://astro.build/config
4040
export default defineConfig({
41+
fonts: [
42+
{
43+
provider: fontProviders.fontsource(),
44+
name: "Stack Sans Headline",
45+
cssVariable: "--font-stack-sans-headline",
46+
weights: ["200 700"],
47+
styles: ["normal"],
48+
subsets: ["latin", "latin-ext"],
49+
},
50+
],
4151
vite: {
4252
server: { proxy },
4353
preview: { proxy },

‎web/bun.lock‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎web/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"@base-ui/react": "^1.5.0",
1515
"@explodingcamera/css": "^0.0.4",
1616
"@floating-ui/react": "^0.27.19",
17-
"@fontsource-variable/stack-sans-headline": "^5.2.1",
1817
"@icons-pack/react-simple-icons": "^13.13.0",
1918
"@picocss/pico": "^2.1.1",
2019
"@tanstack/react-query": "^5.101.0",

‎web/src/global.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
--pico-form-element-spacing-horizontal: 0.6rem;
1919

2020
--pico-font-family:
21-
"Stack Sans Headline Variable", system-ui, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, Helvetica, Arial,
21+
var(--font-stack-sans-headline), system-ui, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, Helvetica, Arial,
2222
"Helvetica Neue", sans-serif, var(--pico-font-family-emoji);
2323
--pico-font-family-sans-serif: var(--pico-font-family);
2424
font-variant-numeric: tabular-nums;

‎web/src/layouts/Base.astro‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
import "@fontsource-variable/stack-sans-headline";
32
import "../global.css";
43
4+
import { Font } from "astro:assets";
55
import { ClientRouter } from "astro:transitions";
66
77
import ThemeSwitcher from "../components/ThemeSwitcher.astro";
@@ -17,6 +17,7 @@ type Props = { title: string; hideFooter?: boolean; noSwitcher?: boolean };
1717
<meta name="robots" content="noindex" />
1818
<meta name="description" content="Liwan Web Analytics Dashboard" />
1919
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
20+
<Font cssVariable="--font-stack-sans-headline" />
2021
<ClientRouter />
2122
<title>{Astro.props.title} | Liwan</title>
2223
</head>

0 commit comments

Comments
 (0)