postcss-nesting
Advanced tools
Comparing version 10.0.3 to 10.1.0
@@ -5,3 +5,3 @@ { | ||
"license": "CC0-1.0", | ||
"version": "10.0.3", | ||
"version": "10.1.0", | ||
"author": "Jonathan Neal <jonathantneal@hotmail.com>", | ||
@@ -75,3 +75,6 @@ "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting#readme", | ||
"directory": "plugins/postcss-nesting" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
} | ||
} |
101
README.md
@@ -74,2 +74,103 @@ # PostCSS Nesting [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS" width="90" height="90" align="right">][postcss] | ||
## Options | ||
### noIsPseudoSelector | ||
#### Specificity | ||
Before : | ||
```css | ||
#alpha, | ||
.beta { | ||
&:hover { | ||
order: 1; | ||
} | ||
} | ||
``` | ||
After **without** the option : | ||
```js | ||
postcssNesting() | ||
``` | ||
```css | ||
:is(#alpha,.beta):hover { | ||
order: 1; | ||
} | ||
``` | ||
_`.beta:hover` has specificity as if `.beta` where an id selector, matching the specification._ | ||
[specificity: 1, 1, 0](https://polypane.app/css-specificity-calculator/#selector=%3Ais(%23alpha%2C.beta)%3Ahover) | ||
After **with** the option : | ||
```js | ||
postcssNesting({ | ||
noIsPseudoSelector: true | ||
}) | ||
``` | ||
```css | ||
#alpha:hover, .beta:hover { | ||
order: 1; | ||
} | ||
``` | ||
_`.beta:hover` has specificity as if `.beta` where a class selector, conflicting with the specification._ | ||
[specificity: 0, 2, 0](https://polypane.app/css-specificity-calculator/#selector=.beta%3Ahover) | ||
#### Complex selectors | ||
Before : | ||
```css | ||
.alpha > .beta { | ||
& + & { | ||
order: 2; | ||
} | ||
} | ||
``` | ||
After **without** the option : | ||
```js | ||
postcssNesting() | ||
``` | ||
```css | ||
:is(.alpha > .beta) + :is(.alpha > .beta) { | ||
order: 2; | ||
} | ||
``` | ||
After **with** the option : | ||
```js | ||
postcssNesting({ | ||
noIsPseudoSelector: true | ||
}) | ||
``` | ||
```css | ||
.alpha > .beta + .alpha > .beta { | ||
order: 2; | ||
} | ||
``` | ||
_this is a different selector than expected as `.beta + .alpha` matches `.beta` followed by `.alpha`._<br> | ||
_avoid these cases when you disable `:is()`_<br> | ||
_writing the selector without nesting is advised here_ | ||
```css | ||
/* without nesting */ | ||
.alpha > .beta + .beta { | ||
order: 2; | ||
} | ||
``` | ||
### ⚠️ Spec disclaimer | ||
@@ -76,0 +177,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
649761
4713
195
1