Skip to content

Commit 321ad4c

Browse files
selemondevSelemondevricardogobbosouza
authored
docs: add Tailwindcss guide (#199)
* docs: add tailwindcss guide * docs: update --------- Co-authored-by: Selemondev <[email protected]> Co-authored-by: Ricardo Gobbo de Souza <[email protected]>
1 parent 2790b0c commit 321ad4c

File tree

1 file changed

+88
-17
lines changed

1 file changed

+88
-17
lines changed

docs/content/1.getting-started/1.setup.md

Lines changed: 88 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,27 @@ Using Google Fonts in your Nuxt project
55
## Installation
66

77
1. Install `@nuxtjs/google-fonts` dependency to your project:
8+
89
```bash
910
npx nuxi@latest module add google-fonts
1011
```
1112

1213
2. Add it to your `modules` section in your `nuxt.config`:
1314

1415
::code-group
16+
1517
```ts [nuxt.config (Nuxt 3)]
1618
export default defineNuxtConfig({
17-
modules: ['@nuxtjs/google-fonts']
18-
})
19+
modules: ["@nuxtjs/google-fonts"],
20+
});
1921
```
2022

2123
```ts [nuxt.config (Nuxt 2)]
2224
export default {
23-
buildModules: ['@nuxtjs/google-fonts']
24-
}
25+
buildModules: ["@nuxtjs/google-fonts"],
26+
};
2527
```
28+
2629
::
2730

2831
## Options
@@ -33,34 +36,102 @@ You can customize the module's behavior by using the `googleFonts` property in `
3336
export default defineNuxtConfig({
3437
googleFonts: {
3538
// Options
36-
}
37-
})
39+
},
40+
});
3841
```
3942

4043
It is also possible to add the options directly in the module declaration:
4144

4245
```ts [nuxt.config]
4346
export default defineNuxtConfig({
4447
modules: [
45-
['@nuxtjs/google-fonts', {
48+
[
49+
"@nuxtjs/google-fonts",
50+
{
4651
families: {
4752
Roboto: true,
4853
Inter: [400, 700],
49-
'Josefin+Sans': true,
54+
"Josefin+Sans": true,
5055
Lato: [100, 300],
5156
Raleway: {
5257
wght: [100, 400],
53-
ital: [100]
58+
ital: [100],
5459
},
55-
Inter: '200..700',
56-
'Crimson Pro': {
57-
wght: '200..900',
58-
ital: '200..700',
59-
}
60-
}
61-
}],
60+
Inter: "200..700",
61+
"Crimson Pro": {
62+
wght: "200..900",
63+
ital: "200..700",
64+
},
65+
},
66+
},
67+
],
6268
],
63-
})
69+
});
6470
```
6571

6672
See the [module options](/getting-started/options).
73+
74+
## TailwindCss
75+
76+
1. Install `@nuxtjs/tailwindcss` dependency to your project:
77+
78+
```bash
79+
npx nuxi@latest module add tailwindcss
80+
```
81+
82+
2. Add it to your `modules` section in your `nuxt.config`:
83+
84+
::code-group
85+
86+
```ts [nuxt.config (Nuxt 3)]
87+
export default defineNuxtConfig({
88+
modules: ["@nuxtjs/tailwindcss"],
89+
});
90+
```
91+
92+
```ts [nuxt.config (Nuxt 2)]
93+
export default {
94+
buildModules: ["@nuxtjs/tailwindcss"],
95+
};
96+
```
97+
98+
::
99+
100+
3. Configure your desired google font:
101+
102+
```ts
103+
export default defineNuxtConfig({
104+
googleFonts: {
105+
families: {
106+
Roboto: true,
107+
// Other fonts
108+
},
109+
},
110+
});
111+
```
112+
113+
4. Head over to your `tailwind.config.js` file and configure your font(s):
114+
115+
```js
116+
/** @type {import('tailwindcss').Config} */
117+
module.exports = {
118+
content: ["..."],
119+
theme: {
120+
extend: {
121+
fontFamily: {
122+
Roboto: "Roboto",
123+
// Other fonts
124+
},
125+
},
126+
},
127+
plugins: [],
128+
};
129+
```
130+
131+
4. Now you can go ahead and use your font:
132+
133+
```html
134+
<div class="grid place-items-center w-full min-h-screen">
135+
<p class="font-Roboto">Hello @nuxtjs/google-fonts + @nuxtjs/tailwindcss</p>
136+
</div>
137+
```

0 commit comments

Comments
 (0)