lightfold
Version:
lightweight scaffolding and archiving utility CLI.
80 lines (58 loc) • 2.26 kB
Markdown
[![NPM Version][npm-img]][npm-url]
[![CSS Standard Status][css-img]][css-url]
[![Build Status][cli-img]][cli-url]
[![Support Chat][git-img]][git-url]
[] lets you nest style rules inside each other, following the
[] specification.
```pcss
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.
Add [PostCSS Nesting] to your project:
```bash
npm install postcss-nesting --save-dev
```
Use [PostCSS Nesting] to process your CSS:
```js
import postcssNesting from 'postcss-nesting';
postcssNesting.process(YOUR_CSS /*, processOptions, pluginOptions */);
```
Or use it as a [PostCSS] plugin:
```js
import postcss from 'postcss';
import postcssNesting from 'postcss-nesting';
postcss([
postcssNesting(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```
[] runs in all Node environments, with special instructions for:
| [Node](INSTALL.md
| --- | --- | --- | --- | --- |
[]: https://img.shields.io/travis/jonathantneal/postcss-nesting.svg
[]: https://travis-ci.org/jonathantneal/postcss-nesting
[]: https://cssdb.org/badge/nesting-rules.svg
[]: https://cssdb.org/#nesting-rules
[]: https://img.shields.io/badge/support-chat-blue.svg
[]: https://gitter.im/postcss/postcss
[]: https://img.shields.io/npm/v/postcss-nesting.svg
[]: https://www.npmjs.com/package/postcss-nesting
[]: https://drafts.csswg.org/css-nesting-1/
[]: https://github.com/postcss/postcss
[]: https://github.com/jonathantneal/postcss-nesting