|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.7 KB
|
| Rev | Line | |
|---|
| [9af201e] | 1 | # tailwindcss/nesting
|
|---|
| 2 |
|
|---|
| 3 | This is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/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`.
|
|---|
| 4 |
|
|---|
| 5 | Add it to your PostCSS configuration, somewhere before Tailwind itself:
|
|---|
| 6 |
|
|---|
| 7 | ```js
|
|---|
| 8 | // postcss.config.js
|
|---|
| 9 | module.exports = {
|
|---|
| 10 | plugins: [
|
|---|
| 11 | require('postcss-import'),
|
|---|
| 12 | require('tailwindcss/nesting'),
|
|---|
| 13 | require('tailwindcss'),
|
|---|
| 14 | require('autoprefixer'),
|
|---|
| 15 | ]
|
|---|
| 16 | }
|
|---|
| 17 | ```
|
|---|
| 18 |
|
|---|
| 19 | 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](https://tailwindcss.com/docs/plugins#css-in-js-syntax).
|
|---|
| 20 |
|
|---|
| 21 | If you'd rather use [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/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:
|
|---|
| 22 |
|
|---|
| 23 | ```shell
|
|---|
| 24 | npm install postcss-nesting
|
|---|
| 25 | ```
|
|---|
| 26 |
|
|---|
| 27 | Then pass the plugin itself as an argument to `tailwindcss/nesting` in your PostCSS configuration:
|
|---|
| 28 |
|
|---|
| 29 | ```js
|
|---|
| 30 | // postcss.config.js
|
|---|
| 31 | module.exports = {
|
|---|
| 32 | plugins: [
|
|---|
| 33 | require('postcss-import'),
|
|---|
| 34 | require('tailwindcss/nesting')(require('postcss-nesting')),
|
|---|
| 35 | require('tailwindcss'),
|
|---|
| 36 | require('autoprefixer'),
|
|---|
| 37 | ]
|
|---|
| 38 | }
|
|---|
| 39 | ```
|
|---|
| 40 |
|
|---|
| 41 | 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.
|
|---|
| 42 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.