From f1c39936df2d5498c0be4506f51fa042737cb4eb Mon Sep 17 00:00:00 2001 From: serenity <98162476+NekoDrone@users.noreply.github.com> Date: Tue, 14 Apr 2026 12:38:02 +0800 Subject: [PATCH] feat: fonts --- astro.config.mjs | 29 +++++++++++++++++++++++------ src/layouts/RootLayout.astro | 24 ++++++++++++++++++++++++ src/pages/index.astro | 19 +++++-------------- 3 files changed, 52 insertions(+), 20 deletions(-) create mode 100644 src/layouts/RootLayout.astro diff --git a/astro.config.mjs b/astro.config.mjs index 508cbec..1d33705 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,11 +1,28 @@ // @ts-check -import { defineConfig } from 'astro/config'; +import { defineConfig, fontProviders } from "astro/config"; -import tailwindcss from '@tailwindcss/vite'; +import tailwindcss from "@tailwindcss/vite"; // https://astro.build/config export default defineConfig({ - vite: { - plugins: [tailwindcss()] - } -}); \ No newline at end of file + vite: { + plugins: [tailwindcss()] + }, + fonts: [ + { + provider: fontProviders.fontsource(), + name: "Hanken Grotesk", + cssVariable: "--font-hanken-grotesk" + }, + { + provider: fontProviders.fontsource(), + name: "Amiri", + cssVariable: "--font-amiri" + }, + { + provider: fontProviders.fontsource(), + name: "Maple Mono", + cssVariable: "--font-maple-mono" + } + ] +}); diff --git a/src/layouts/RootLayout.astro b/src/layouts/RootLayout.astro new file mode 100644 index 0000000..b479f5b --- /dev/null +++ b/src/layouts/RootLayout.astro @@ -0,0 +1,24 @@ +--- +import { Font } from "astro:assets"; +import "../styles/global.css"; +const { title } = Astro.props; +--- + + +
+ + + + + + + + +