Unverified Commit 6800e1ec authored by Niaz Morshed Nayeem's avatar Niaz Morshed Nayeem Committed by GitHub

docs: update tailwind installation instruction to v4 (#75739)

parent cf73ab10
......@@ -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: [],
}
```
......@@ -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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment