Skip to content

Commit 673deef

Browse files
authored
refactor: update font config guide in fonts.ts (#164)
Resolves #136
1 parent 64d8f32 commit 673deef

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

src/config/fonts.ts

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
/**
2-
* List of available font names (visit the url`/settings/appearance`).
3-
* This array is used to generate Tailwind's `safelist` inside 'tailwind.config.js' and 'appearance-form.tsx'
4-
* to prevent dynamic font classes (e.g., `font-inter`, `font-manrope`) from being removed during purging.
2+
* List of available font names (visit the url `/settings/appearance`).
3+
* This array is used to generate dynamic font classes (e.g., `font-inter`, `font-manrope`).
54
*
6-
* 📝 How to Add a New Font:
5+
* 📝 How to Add a New Font (Tailwind v4+):
76
* 1. Add the font name here.
87
* 2. Update the `<link>` tag in 'index.html' to include the new font from Google Fonts (or any other source).
9-
* 3. Add new fontFamily 'tailwind.config.js'
8+
* 3. Add the new font family to 'index.css' using the `@theme inline` and `font-family` CSS variable.
109
*
1110
* Example:
1211
* fonts.ts → Add 'roboto' to this array.
1312
* index.html → Add Google Fonts link for Roboto.
14-
* tailwind.config.js → Add the new font inside `theme.extend.fontFamily`.
15-
* ```ts
16-
* theme: {
17-
* // other configs
18-
* extend: {
19-
* fontFamily: {
20-
* inter: ['Inter', ...fontFamily.sans],
21-
* manrope: ['Manrope', ...fontFamily.sans],
22-
* roboto: ['Roboto', ...fontFamily.sans], // Add new font here
23-
* }
13+
* index.css → Add the new font in the CSS, e.g.:
14+
* @theme inline {
15+
* // ... other font families
16+
* --font-roboto: 'Roboto', var(--font-sans);
2417
* }
25-
* }
26-
* ```
2718
*/
2819
export const fonts = ['inter', 'manrope', 'system'] as const

0 commit comments

Comments
 (0)