postcss-nesting
Nest style rules inside each other
Last updated 6 years ago by jonathantneal .
CC0-1.0 · Repository · Bugs · Original npm
$ cnpm install postcss-nesting 
SYNC missed versions from official npm registry.

PostCSS Nesting PostCSS

NPM Version CSS Standard Status Build Status Support Chat

PostCSS Nesting lets you nest style rules inside each other, following the CSS Nesting 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 to your project:

npm install postcss-nesting --save-dev

Use PostCSS Nesting to process your CSS:

import postcssNesting from 'postcss-nesting';

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

Or use it as a PostCSS plugin:

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

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

PostCSS Nesting runs in all Node environments, with special instructions for:

Node Webpack Create React App Gulp Grunt

Current Tags

  • 10.2.0                                ...           latest (3 years ago)

7 Versions

  • 10.2.0                                ...           3 years ago
  • 10.1.5                                ...           3 years ago
  • 10.1.2                                ...           4 years ago
  • 4.2.1                                ...           8 years ago
  • 7.0.1                                ...           6 years ago
  • 7.0.0                                ...           7 years ago
  • 2.3.1                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (10)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org