{"name":"postcss-nesting","description":"Nest rules inside each other in CSS","license":"CC0-1.0","version":"8.0.1","type":"module","main":"postcss-8-nesting/postcss-nesting.cjs","module":"postcss-8-nesting/postcss-nesting.mjs","jsdelivr":"postcss-8-nesting/postcss-nesting.mjs","unpkg":"postcss-8-nesting/postcss-nesting.mjs","publishConfig":{"access":"public"},"author":{"name":"Jonathan Neal","email":"jonathantneal@hotmail.com"},"bugs":{"url":"https://github.com/csstools/postcss-nesting/issues"},"homepage":"https://github.com/csstools/postcss-nesting#readme","repository":{"type":"git","url":"git+https://github.com/csstools/postcss-nesting.git"},"exports":{".":{"import":"./postcss-8-nesting/postcss-nesting.mjs","require":"./postcss-8-nesting/postcss-nesting.cjs","default":"./postcss-8-nesting/postcss-nesting.mjs"},"./postcss-7-nesting":{"import":"./postcss-7-nesting/postcss-nesting.mjs","require":"./postcss-7-nesting/postcss-nesting.cjs","default":"./postcss-7-nesting/postcss-nesting.mjs"},"./postcss-8-nesting":{"import":"./postcss-8-nesting/postcss-nesting.mjs","require":"./postcss-8-nesting/postcss-nesting.cjs","default":"./postcss-8-nesting/postcss-nesting.mjs"}},"scripts":{"prepublishOnly":"npm test","build":"node .bin/build.js","test":"node .bin/test.js","test:lint":"node .bin/test-lint.js","test:tape":"node .bin/test-tape.js"},"devDependencies":{"esbuild":"0.11.17","eslint":"7.25.0","eslint-config-dev":"2.0.0","nodemon":"2.0.7","postcss":"8.2.6","pre-commit":"1.2.2"},"browserslist":["node >= 12"],"engines":{"node":"12 - 16"},"eslintConfig":{"extends":"eslint:recommended","parserOptions":{"ecmaVersion":12,"sourceType":"module","ecmaFeatures":{"modules":true}},"rules":{"semi":["error","never"]}},"peerDependencies":{"postcss":"^8"},"prettier":{"arrowParens":"always","bracketSpacing":true,"printWidth":240,"semi":false,"singleQuote":true,"tabWidth":2,"trailingComma":"all","useTabs":true,"overrides":[{"files":["*.json","*.md",".prettierrc","*.yml"],"options":{"useTabs":false}}]},"sideEffects":false,"keywords":["postcss","postcss-plugin","css","atrules","child","children","cssnext","nested","nestings","rules","selectors","syntax","specifications","specs","w3c","csswg"],"gitHead":"69da21c407d319b10524098832423435f73318e4","_id":"postcss-nesting@8.0.1","_nodeVersion":"16.0.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-cHPNhW5VvRQjszFDxmy16mis9qFQqQLBNw6KVmueLqqE3M182ZAk9+QoxGqbGVryzLVhannw2B5Yhosqq522fA==","shasum":"4a8ab3c540a0f138fd3f5d2ee65e4a24d1888024","tarball":"http://registry-npm.ywwl.com/postcss-nesting/download/postcss-nesting-8.0.1.tgz","fileCount":13,"unpackedSize":71257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgjhGiCRA9TVsSAnZWagAAceoP/R1p5M1ZqQPcgoFpAzQe\nwWXFav0vaY/0vs9vjXDwPHO5PYtDhC1jgL6SG2RbySB7R1y4dnwGN3hcGWGr\nNAOFhcH3buKt2lYUxjUBoOAQbQ+2wRH2i7KmSw9f/HXESiC30Z6ZiJ5Q4RWG\n5twm8soYTm5gwZhmGddNUoGZnmo/N9nKPPsL72h4q9f1brxZki4NwBCgWTRG\n6/3I6jGq8pBnqgsBdmBl6spK0XA8/DqnUem1ASQXmYocWdn6NqO5h+v9MEZT\nFzJCYO2bCbG1ntiLtDL31DpRZEb9zxsUron63CaTyO+tHzy4QW/MZ29xhw5z\nQZfMKEEfmlyc6G57RNBtoMnei+BUCy48+X8IuFRnQDOAJtFIaRXrezpJWvKK\nmvjIk15fW1m/eO/FQRX1uQtfy1ckaX0t+450+q1xFOlQ4nklqAzqiZRrtp4N\n9I6zggia5krY3ctTCnrF8SwHSLEgOnhgoZ4aY2S3pw5l+ZnYLR4ZFs2Gwf1A\n+zB2nAF10lNUWYSt4VXhyvIgBqG+EyMyBQ+s2hKqCt2iqHAcUfk3zg9fTFxd\nnkcvR32bjZCeseMUFq+93YRUVpd9f8jZ2JynkHd1rQNFngLXK+/J/gTlH5MY\nPQGaJ9E470ca5vEmLiESKIIEcN88AdC8pFTb+5+haBiHYwfDnw1akBcyjPNu\nYFDX\r\n=OSD8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC+laXMCLUDrDD0J3Y8WHRZ77StTu0upkXRp8iHnpgPnwIhANtKu3jRcDGkaTsfhIsKRGXtWriYz6Cm5ZcNRPpU7tAt"}],"size":11276,"noattachment":false,"key":"/postcss-nesting/-/postcss-nesting-8.0.1.tgz"},"_npmUser":{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},"directories":{},"maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/postcss-nesting_8.0.1_1619923361809_0.3815884934301199"},"_hasShrinkwrap":false,"readme":"# PostCSS Nesting [<img src=\"https://postcss.github.io/postcss/logo.svg\" alt=\"PostCSS Logo\" width=\"90\" height=\"90\" align=\"right\">][PostCSS]\n\n[<img alt=\"npm version\" src=\"https://img.shields.io/npm/v/postcss-nesting.svg\" height=\"20\">][npm-url] [<img alt=\"Build Status\" src=\"https://github.com/csstools/postcss-plugins/workflows/test/badge.svg\" height=\"20\">][cli-url] [<img alt=\"Discord\" src=\"https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white\">][discord]<br><br>[<img alt=\"Baseline Status\" src=\"https://cssdb.org/images/badges-baseline/nesting-rules.svg\" height=\"20\">][css-url] [<img alt=\"CSS Standard Status\" src=\"https://cssdb.org/images/badges/nesting-rules.svg\" height=\"20\">][css-url] \n\n```bash\nnpm install postcss-nesting --save-dev\n```\n\n[PostCSS Nesting] lets you nest style rules inside each other, following the [CSS Nesting specification].\n\nIf you want nested rules the same way [Sass] works\nyou might want to use [PostCSS Nested] instead.\n\n```pcss\n.foo {\n\tcolor: red;\n\n\t&:hover {\n\t\tcolor: green;\n\t}\n\n\t> .bar {\n\t\tcolor: blue;\n\t}\n\n\t@media (prefers-color-scheme: dark) {\n\t\tcolor: cyan;\n\t}\n\n\tcolor: pink;\n}\n\n/* becomes */\n\n.foo {\n\tcolor: red;\n\n\tcolor: pink;\n}\n.foo:hover {\n\t\tcolor: green;\n\t}\n.foo > .bar {\n\t\tcolor: blue;\n\t}\n@media (prefers-color-scheme: dark) {\n\t.foo {\n\t\tcolor: cyan;\n}\n\t}\n```\n\n## Usage\n\nAdd [PostCSS Nesting] to your project:\n\n```bash\nnpm install postcss postcss-nesting --save-dev\n```\n\nUse it as a [PostCSS] plugin:\n\n```js\nconst postcss = require('postcss');\nconst postcssNesting = require('postcss-nesting');\n\npostcss([\n\tpostcssNesting(/* pluginOptions */)\n]).process(YOUR_CSS /*, processOptions */);\n```\n\n[PostCSS Nesting] runs in all Node environments, with special\ninstructions for:\n\n- [Node](INSTALL.md#node)\n- [PostCSS CLI](INSTALL.md#postcss-cli)\n- [PostCSS Load Config](INSTALL.md#postcss-load-config)\n- [Webpack](INSTALL.md#webpack)\n- [Next.js](INSTALL.md#nextjs)\n- [Gulp](INSTALL.md#gulp)\n- [Grunt](INSTALL.md#grunt)\n\n## ⚠️ `@nest` has been removed from the specification.\n\nPrevious iterations of the [CSS Nesting specification] required using `@nest` for certain selectors.\n\n`@nest` was removed from the specification completely.\nFuture versions of this plugin will error if you use `@nest`.\n\nWe advice everyone to migrate their codebase **now** to nested CSS without `@nest`.  \nWe published a [Stylelint Plugin](https://github.com/csstools/postcss-plugins/tree/main/plugins-stylelint/no-at-nest-rule#csstoolsstylelint-no-at-nest-rule) to help you migrate.\n\nexample warning:\n> `@nest` was removed from the CSS Nesting specification and will be removed from PostCSS Nesting in the next major version.\n> Change `@nest foo & {}` to `foo & {}` to migrate to the latest standard.\n\nYou can silence this warning with a new `silenceAtNestWarning` plugin option.\n\n```js\npostcssNesting({\n\tsilenceAtNestWarning: true\n})\n```\n\n## Options\n\n### edition\n\nThe default behavior is to transpile CSS following an older version of the CSS nesting specification.\n\nIf you want to already use the latest version you can set the `edition` option to `2024-02`.\n\n```js\npostcssNesting({\n\tedition: '2024-02'\n})\n```\n\n#### `2021` (default)\n\nThis version is a continuation of what existed before CSS nesting was implemented in browsers.  \nIt made a few non-invasive changes to keep up with implementations but it is falling behind.\n\nIn a future version of this plugin this will no longer be the default.\n\n```pcss\n.foo {\n\tcolor: red;\n\n\t&:hover {\n\t\tcolor: green;\n\t}\n\n\t> .bar {\n\t\tcolor: blue;\n\t}\n\n\t@media (prefers-color-scheme: dark) {\n\t\tcolor: cyan;\n\t}\n\n\tcolor: pink;\n}\n\n/* becomes */\n\n.foo {\n\tcolor: red;\n\n\tcolor: pink;\n}\n.foo:hover {\n\t\tcolor: green;\n\t}\n.foo > .bar {\n\t\tcolor: blue;\n\t}\n@media (prefers-color-scheme: dark) {\n\t.foo {\n\t\tcolor: cyan;\n}\n\t}\n```\n\n#### `2024-02`\n\n- usage of `:is()` pseudo-class is no longer optional\n- at rules are not combined with the `and` keyword\n- `@nest` is removed from the specification\n- declarations and nested rules/at-rules are no longer re-ordered\n\n```pcss\n.foo {\n\tcolor: red;\n\n\t&:hover {\n\t\tcolor: green;\n\t}\n\n\t> .bar {\n\t\tcolor: blue;\n\t}\n\n\t@media (prefers-color-scheme: dark) {\n\t\tcolor: cyan;\n\t}\n\n\tcolor: pink;\n}\n\n/* becomes */\n\n.foo {\n\tcolor: red;\n}\n.foo:hover {\n\t\tcolor: green;\n\t}\n.foo  > .bar {\n\t\tcolor: blue;\n\t}\n@media (prefers-color-scheme: dark) {\n\t.foo {\n\t\tcolor: cyan;\n}\n\t}\n.foo {\n\n\tcolor: pink;\n}\n```\n\n### noIsPseudoSelector\n\n#### Specificity\n\nBefore :\n\n```css\n#alpha,\n.beta {\n\t&:hover {\n\t\torder: 1;\n\t}\n}\n```\n\nAfter **without** the option :\n\n```js\npostcssNesting()\n```\n\n```css\n:is(#alpha,.beta):hover {\n\torder: 1;\n}\n```\n\n_`.beta:hover` has specificity as if `.beta` where an id selector, matching the specification._\n\n[specificity: 1, 1, 0](https://polypane.app/css-specificity-calculator/#selector=%3Ais(%23alpha%2C.beta)%3Ahover)\n\nAfter **with** the option :\n\n```js\npostcssNesting({\n\tnoIsPseudoSelector: true\n})\n```\n\n```css\n#alpha:hover, .beta:hover {\n\torder: 1;\n}\n```\n\n_`.beta:hover` has specificity as if `.beta` where a class selector, conflicting with the specification._\n\n[specificity: 0, 2, 0](https://polypane.app/css-specificity-calculator/#selector=.beta%3Ahover)\n\n\n#### Complex selectors\n\nBefore :\n\n```css\n.alpha > .beta {\n\t& + & {\n\t\torder: 2;\n\t}\n}\n```\n\nAfter **without** the option :\n\n```js\npostcssNesting()\n```\n\n```css\n:is(.alpha > .beta) + :is(.alpha > .beta) {\n\torder: 2;\n}\n```\n\nAfter **with** the option :\n\n```js\npostcssNesting({\n\tnoIsPseudoSelector: true\n})\n```\n\n```css\n.alpha > .beta + .alpha > .beta {\n\torder: 2;\n}\n```\n\n_this is a different selector than expected as `.beta + .alpha` matches `.beta` followed by `.alpha`._<br>\n_avoid these cases when you disable `:is()`_<br>\n_writing the selector without nesting is advised here_\n\n```css\n/* without nesting */\n.alpha > .beta + .beta {\n\torder: 2;\n}\n```\n\n[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test\n[css-url]: https://cssdb.org/#nesting-rules\n[discord]: https://discord.gg/bUadyRwkJS\n[npm-url]: https://www.npmjs.com/package/postcss-nesting\n\n[PostCSS]: https://github.com/postcss/postcss\n[PostCSS Nesting]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting\n[PostCSS Nested]: https://github.com/postcss/postcss-nested\n[Sass]: https://sass-lang.com/\n[CSS Nesting specification]: https://www.w3.org/TR/css-nesting-1/\n","publish_time":1619923361934,"_cnpm_publish_time":1619923361934,"dist-tags":{"latest":"14.0.3"}}