# PostCSS Nesting

[![NPM Version](https://img.shields.io/npm/v/postcss-nesting.svg)](https://www.npmjs.com/package/postcss-nesting) [![CSS Standard Status](https://cssdb.org/badge/nesting-rules.svg)](https://cssdb.org/#nesting-rules) [![Build Status](https://img.shields.io/travis/jonathantneal/postcss-nesting.svg)](https://travis-ci.org/jonathantneal/postcss-nesting) [![Support Chat](https://img.shields.io/badge/support-chat-blue.svg)](https://gitter.im/postcss/postcss)

[PostCSS Nesting](https://github.com/jonathantneal/postcss-nesting) lets you nest style rules inside each other, following the [CSS Nesting](https://drafts.csswg.org/css-nesting-1/) specification.

```
a, b {
  color: red;

  & c, & d {
    color: white;
  }
}

/* becomes */

a, b {
  color: red;
}

a c, a d, b c, b d {
  color: white;
}
```

**NOTICE**: In a future version of this project, nesting at-rules like `@media` may be deprecated, as they are not part of the nesting proposal. In a comment, a CSSWG member expressed interest in handling nested `@media` while handling selector nesting. So deprecating nested at-rules has been temporarily delayed.

## Usage

Add [PostCSS Nesting](https://github.com/jonathantneal/postcss-nesting) to your project:

```bash
npm install postcss-nesting --save-dev
```

Use [PostCSS Nesting](https://github.com/jonathantneal/postcss-nesting) to process your CSS:

```js
import postcssNesting from 'postcss-nesting';

postcssNesting.process(YOUR_CSS /*, processOptions, pluginOptions */);
```

Or use it as a [PostCSS](https://github.com/postcss/postcss) plugin:

```js
import postcss from 'postcss';
import postcssNesting from 'postcss-nesting';

postcss([
  postcssNesting(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```

[PostCSS Nesting](https://github.com/jonathantneal/postcss-nesting) runs in all Node environments, with special instructions for:

| [Node](https://github.com/bgoonz/Learning-Redux/blob/master/repos/examples/real-world/node_modules/postcss-nesting/INSTALL.md#node) | [Webpack](https://github.com/bgoonz/Learning-Redux/blob/master/repos/examples/real-world/node_modules/postcss-nesting/INSTALL.md#webpack) | [Create React App](https://github.com/bgoonz/Learning-Redux/blob/master/repos/examples/real-world/node_modules/postcss-nesting/INSTALL.md#create-react-app) | [Gulp](https://github.com/bgoonz/Learning-Redux/blob/master/repos/examples/real-world/node_modules/postcss-nesting/INSTALL.md#gulp) | [Grunt](https://github.com/bgoonz/Learning-Redux/blob/master/repos/examples/real-world/node_modules/postcss-nesting/INSTALL.md#grunt) |
| ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
