You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use custom fonts by creating the `./public/fonts` directory (if it
10
-
doesn't already exist) and adding them to it.
11
-
[Google Fonts](https://fonts.google.com/) is a good place to find open source
12
-
fonts. You will also need to add the `css` file for the font to the
13
-
`./app/styles` directory, if your font doesn't come with one (Google Fonts
14
-
don't) you can generate one using a tool like
15
-
[Transfonter](https://transfonter.org/). Transfonter now has a fonts directory
16
-
setting. Set that to `fonts` to have the `url` preset.
9
+
For custom fonts, Epic Stack uses [`fontless`](https://github.com/unjs/fontaine/tree/main/packages/fontless) for automatic font optimization. This provides zero-runtime font loading with proper fallbacks to reduce Cumulative Layout Shift (CLS).
17
10
18
-
Verify the `url` in the `css` is relative to the `public` folder. So it should
19
-
look something like `url('/fonts/yourfont/yourfont-200.woff2')`.
11
+
## How it works
20
12
21
-
Now you've added your font, there's a few places you need to update to use it.
13
+
Simply use font families in your CSS and `fontless` handles the rest:
22
14
23
-
1. Add your font to the CSS variables.
15
+
```css
16
+
.font-title {
17
+
font-family: "Poppins", sans-serif;
18
+
}
24
19
25
-
```css
26
-
/* tailwind.css */
27
-
@layer base {
28
-
:root {
29
-
--font-sans: <YourFont>;
30
-
}
31
-
}
32
-
```
20
+
.body-text {
21
+
font-family: "Inter", sans-serif;
22
+
}
23
+
```
33
24
34
-
2. Import the default theme and add your font to the `fontFamily` property.
25
+
The plugin will:
26
+
- Detect font-family declarations in your CSS
27
+
- Resolve fonts from providers (Google Fonts, Bunny Fonts, etc.)
This is expected behavior. Fonts are only generated in the build files. To see fonts in development mode, build the application first and then run `npm run dev`.
0 commit comments