You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/docs/using-with-preprocessors.mdx
+23-14Lines changed: 23 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -122,22 +122,16 @@ The `postcss-import` plugin is smart enough to look for files in the `node_modul
122
122
123
123
### Nesting
124
124
125
-
To add support for nested declarations, we recommend [@tailwindcss/nesting](https://github.com/tailwindlabs/tailwindcss-nesting), which is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/jonathantneal/postcss-nesting) and acts as a compatibility layer to make sure your nesting plugin of choice properly understands custom syntax like `@apply` and `@screen`.
125
+
To add support for nested declarations, we recommend our bundled `tailwindcss/nesting` plugin, which is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/jonathantneal/postcss-nesting) and acts as a compatibility layer to make sure your nesting plugin of choice properly understands Tailwind's custom syntax like `@apply` and `@screen`.
126
126
127
-
To use it, install it via npm:
128
-
129
-
```shell
130
-
npm install @tailwindcss/nesting
131
-
```
132
-
133
-
Then add it to your PostCSS configuration, somewhere before Tailwind itself:
127
+
It's included directly in the `tailwindcss` package itself, so to use it all you need to do is add it to your PostCSS configuration, somewhere before Tailwind:
134
128
135
129
```js
136
130
// postcss.config.js
137
131
module.exports= {
138
132
plugins: [
139
133
require('postcss-import'),
140
-
require('@tailwindcss/nesting'),
134
+
require('tailwindcss/nesting'),
141
135
require('tailwindcss'),
142
136
require('autoprefixer'),
143
137
]
@@ -146,28 +140,43 @@ module.exports = {
146
140
147
141
By default, it uses the [postcss-nested](https://github.com/postcss/postcss-nested) plugin under the hood, which uses a Sass-like syntax and is the plugin that powers nesting support in the [Tailwind CSS plugin API](/docs/plugins#css-in-js-syntax).
148
142
149
-
If you'd rather use [postcss-nesting](https://github.com/jonathantneal/postcss-nesting) (which is based on the work-in-progress [CSS Nesting](https://drafts.csswg.org/css-nesting-1/) specification), first install the plugin alongside `@tailwindcss/nesting`:
143
+
If you'd rather use [postcss-nesting](https://github.com/jonathantneal/postcss-nesting) (which is based on the work-in-progress [CSS Nesting](https://drafts.csswg.org/css-nesting-1/) specification), first install the plugin:
150
144
151
145
```shell
152
-
npm install @tailwindcss/nesting postcss-nesting
146
+
npm install postcss-nesting
153
147
```
154
148
155
-
Then pass the plugin itself as an argument to `@tailwindcss/nesting` in your PostCSS configuration:
149
+
Then pass the plugin itself as an argument to `tailwindcss/nesting` in your PostCSS configuration:
This can also be helpful if for whatever reason you need to use a very specific version of `postcss-nested` and want to override the version we bundle with `@tailwindcss/nesting` itself.
163
+
This can also be helpful if for whatever reason you need to use a very specific version of `postcss-nested` and want to override the version we bundle with `tailwindcss/nesting` itself.
164
+
165
+
Note that if you are using [`postcss-preset-env`](https://github.com/csstools/postcss-preset-env) in your project, you should make sure to disable nesting and let `tailwindcss/nesting` handle it for you instead:
0 commit comments