From 9eb4cfecfca9335fdd21aaf1423c264e9d67a0f2 Mon Sep 17 00:00:00 2001 From: Rishi Raj Jain Date: Fri, 26 Jan 2024 18:53:48 +0530 Subject: [PATCH 1/3] Update Base.astro --- src/layouts/Base.astro | 43 +++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index cec2c8f..87e97e5 100755 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -1,4 +1,5 @@ --- +import { AstroFont } from "astro-font"; import TwSizeIndicator from "@/components/TwSizeIndicator.astro"; import config from "@/config/config.json"; import theme from "@/config/theme.json"; @@ -13,6 +14,18 @@ import SearchModal from "./helpers/SearchModal"; const pf = theme.fonts.font_family.primary; const sf = theme.fonts.font_family.secondary; +let fontPrimary, fontSecondary; +if (theme.fonts.font_family.primary) { + fontPrimary = theme.fonts.font_family.primary + .replace(/\+/g, " ") + .replace(/:[ital,]*[ital@]*[wght@]*[0-9,;]+/gi, ""); +} +if (theme.fonts.font_family.secondary) { + fontSecondary = theme.fonts.font_family.secondary + .replace(/\+/g, " ") + .replace(/:[ital,]*[ital@]*[wght@]*[0-9,;]+/gi, ""); +} + // types for frontmatters export interface Props { title?: string; @@ -50,15 +63,27 @@ const { title, meta_title, description, image, noindex, canonical } = - - - From af941d5d7ed831b0b144aa8434e647e538d86223 Mon Sep 17 00:00:00 2001 From: Rishi Raj Jain Date: Fri, 26 Jan 2024 18:53:58 +0530 Subject: [PATCH 2/3] Update tailwind.config.js --- tailwind.config.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tailwind.config.js b/tailwind.config.js index 02aa7b6..042d889 100755 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -8,17 +8,12 @@ let h4 = h5 * font_scale; let h3 = h4 * font_scale; let h2 = h3 * font_scale; let h1 = h2 * font_scale; -let fontPrimary, fontPrimaryType, fontSecondary, fontSecondaryType; + +let fontPrimaryType, fontSecondaryType; if (theme.fonts.font_family.primary) { - fontPrimary = theme.fonts.font_family.primary - .replace(/\+/g, " ") - .replace(/:[ital,]*[ital@]*[wght@]*[0-9,;]+/gi, ""); fontPrimaryType = theme.fonts.font_family.primary_type; } if (theme.fonts.font_family.secondary) { - fontSecondary = theme.fonts.font_family.secondary - .replace(/\+/g, " ") - .replace(/:[ital,]*[ital@]*[wght@]*[0-9,;]+/gi, ""); fontSecondaryType = theme.fonts.font_family.secondary_type; } @@ -75,8 +70,8 @@ module.exports = { h6: h6 + "rem", }, fontFamily: { - primary: [fontPrimary, fontPrimaryType], - secondary: [fontSecondary, fontSecondaryType], + primary: ["var(--font-primary)", fontPrimaryType], + secondary: ["var(--font-secondary)", fontSecondaryType], }, }, }, From 5710c2f51dda9877d72446b1f97507cb4a044b21 Mon Sep 17 00:00:00 2001 From: Rishi Raj Jain Date: Fri, 26 Jan 2024 18:54:10 +0530 Subject: [PATCH 3/3] Update package.json --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index db3eaba..784586d 100755 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@astrojs/tailwind": "^5.1.0", "astro": "^4.0.9", "astro-auto-import": "^0.4.2", + "astro-font": "^0.0.77", "date-fns": "^3.0.6", "disqus-react": "^1.1.5", "github-slugger": "^2.0.0", @@ -52,8 +53,8 @@ "prettier-plugin-astro": "^0.12.3", "prettier-plugin-tailwindcss": "^0.5.10", "sass": "^1.69.7", - "tailwindcss": "^3.4.0", "tailwind-bootstrap-grid": "^5.1.0", + "tailwindcss": "^3.4.0", "typescript": "5.3.3" } }