Hy guys. So, let's begin:
https://docs.astro.build/en/guides/fonts/#using-fontsource I follow the steps from here to install with fontsource (not my first time using this).
I've installed 2 fonts: "@fontsource/cormorant-garamond": "^5.1.0", "@fontsource/montserrat": "^5.1.0".
I have a Layout.astro, where I import these 2 fonts, and where I also followed fontsource guide to preload fonts, from astro docs:
See the Fontsource guide to preloading fonts for more information and usage.
https://fontsource.org/docs/getting-started/preload
Layout.astro:
import "@fontsource/montserrat";
import "@fontsource/cormorant-garamond";
import montserratWoff2 from "@fontsource/montserrat/files/montserrat-latin-400-normal.woff2";
import cormorantGaramondWoff2 from "@fontsource/cormorant-garamond/files/cormorant-garamond-latin-400-normal.woff2";
<html lang="ro">
<head>
<link
rel="preload"
as="font"
type="font/woff2"
href={montserratWoff2}
crossorigin="anonymous"
/>
<link
rel="preload"
as="font"
type="font/woff2"
href={cormorantGaramondWoff2}
crossorigin="anonymous"
/>
</head>
<body>
<slot />
</body>
</html>
My tailwind config looks like this (installed with astro integration), and again respecting the docs. I want to make tailwind default font to cormorant garamond (again, not my first time doing this):
import defaultTheme from "tailwindcss/defaultTheme";
/** @type {import('tailwindcss').Config} /
export default {
content: ["./src/**/.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"],
theme: {
extend: {
fontFamily: {
sans: [
'"Cormorant Garamond"',
'"serif"',
...defaultTheme.fontFamily.sans,
],
},
},
},
plugins: [],
};
I go in dev mode, in browser console (firefox) to check my font, and my used font is serif in case of cormorant, and sans-serif in case of montserat. So in both cases, the fallback fonts.Help