Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] update tailwind installation instruction to v4 #75739

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 8 additions & 33 deletions docs/01-app/01-getting-started/05-css.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -103,45 +103,22 @@ export default function RootLayout({ children }) {

### Installing Tailwind

To start using Tailwind, install the Tailwind CSS packages and run the `init` command to generate both the `tailwind.config.js` and `postcss.config.js` files:
To start using Tailwind, install the necessary Tailwind CSS packages:

```bash filename="Terminal"
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
npm install -D tailwindcss @tailwindcss/postcss postcss
```

### Configuring Tailwind

Inside your Tailwind configuration file, add paths to the files that will use the Tailwind class names:
Create a `postcss.config.mjs` file in the root of your project and add the `@tailwindcss/postcss` plugin to your PostCSS configuration:

```ts filename="tailwind.config.ts" highlight={5-7} switcher
import type { Config } from 'tailwindcss'

export default {
content: [
'./app/**/*.{js,ts,jsx,tsx,mdx}',
// Or if using `src` directory:
'./src/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {},
},
plugins: [],
} satisfies Config
```

```js filename="tailwind.config.js" highlight={4-6} switcher
```js filename="postcss.config.mjs" highlight={4}
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./app/**/*.{js,ts,jsx,tsx,mdx}',
// Or if using `src` directory:
'./src/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {},
export default {
plugins: {
'@tailwindcss/postcss': {},
},
plugins: [],
}
```

Expand All @@ -150,9 +127,7 @@ module.exports = {
Add the [Tailwind directives](https://tailwindcss.com/docs/functions-and-directives#directives) to your [Global Stylesheet](#global-css):

```css filename="app/globals.css"
@tailwind base;
@tailwind components;
@tailwind utilities;
@import 'tailwindcss';
```

Then, import the styles in the [root layout](/docs/app/api-reference/file-conventions/layout#root-layouts):
Expand Down
Loading