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 }) { ...@@ -103,45 +103,22 @@ export default function RootLayout({ children }) {
### Installing Tailwind ### 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" ```bash filename="Terminal"
npm install -D tailwindcss postcss autoprefixer npm install -D tailwindcss @tailwindcss/postcss postcss
npx tailwindcss init -p
``` ```
### Configuring Tailwind ### 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 ```js filename="postcss.config.mjs" highlight={4}
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
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
module.exports = { export default {
content: [ plugins: {
'./app/**/*.{js,ts,jsx,tsx,mdx}', '@tailwindcss/postcss': {},
// Or if using `src` directory:
'./src/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {},
}, },
plugins: [],
} }
``` ```
...@@ -150,9 +127,7 @@ module.exports = { ...@@ -150,9 +127,7 @@ module.exports = {
Add the [Tailwind directives](https://tailwindcss.com/docs/functions-and-directives#directives) to your [Global Stylesheet](#global-css): Add the [Tailwind directives](https://tailwindcss.com/docs/functions-and-directives#directives) to your [Global Stylesheet](#global-css):
```css filename="app/globals.css" ```css filename="app/globals.css"
@tailwind base; @import 'tailwindcss';
@tailwind components;
@tailwind utilities;
``` ```
Then, import the styles in the [root layout](/docs/app/api-reference/file-conventions/layout#root-layouts): 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