Gathering detailed insights and metrics for @csstools/postcss-is-pseudo-class
Gathering detailed insights and metrics for @csstools/postcss-is-pseudo-class
Gathering detailed insights and metrics for @csstools/postcss-is-pseudo-class
Gathering detailed insights and metrics for @csstools/postcss-is-pseudo-class
npm install @csstools/postcss-is-pseudo-class
Typescript
Module System
Min. Node Version
Node Version
NPM Version
CSS (43.3%)
JavaScript (30.21%)
TypeScript (22.88%)
HTML (3.03%)
Nunjucks (0.48%)
Shell (0.1%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT-0 License
983 Stars
4,382 Commits
77 Forks
9 Watchers
5 Branches
132 Contributors
Updated on Jul 15, 2025
Latest Version
5.0.3
Package Id
@csstools/postcss-is-pseudo-class@5.0.3
Unpacked Size
28.68 kB
Size
6.46 kB
File Count
7
NPM Version
10.9.0
Node Version
22.12.0
Published on
Jun 11, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
PostCSS Is Pseudo Class lets you use the :is
pseudo class function, following the
CSS Selector specification.
1:is(input, button):is(:hover, :focus) { 2 order: 1; 3}
Becomes :
1input:hover { 2 order: 1; 3} 4input:focus { 5 order: 1; 6} 7button:hover { 8 order: 1; 9} 10button:focus { 11 order: 1; 12}
Add PostCSS Is Pseudo Class to your project:
1npm install @csstools/postcss-is-pseudo-class --save-dev
Use PostCSS Is Pseudo Class as a PostCSS plugin:
1import postcss from 'postcss'; 2import postcssIsPseudoClass from '@csstools/postcss-is-pseudo-class'; 3 4postcss([ 5 postcssIsPseudoClass(/* pluginOptions */) 6]).process(YOUR_CSS /*, processOptions */);
PostCSS Is Pseudo Class runs in all Node environments, with special instructions for:
Node | Webpack | Gulp | Grunt |
---|
The preserve
option determines whether the original notation
is preserved. By default, it is not preserved.
1postcss([ 2 postcssIsPseudoClass({ preserve: true }) 3]).process(YOUR_CSS /*, processOptions */);
1:is(input, button):is(:hover, :focus) { 2 order: 1; 3}
Becomes :
1input:hover { 2 order: 1; 3} 4input:focus { 5 order: 1; 6} 7button:hover { 8 order: 1; 9} 10button:focus { 11 order: 1; 12} 13:is(input, button):is(:hover, :focus) { 14 order: 1; 15}
The specificityMatchingName
option allows you to change the selector used to adjust specificity.
The default value is does-not-exist
.
If this is an actual class, id or tag name in your code, you will need to set a different option here.
See how :not
is used to modify specificity.
1postcss([ 2 postcssIsPseudoClass({ specificityMatchingName: 'something-random' }) 3]).process(YOUR_CSS /*, processOptions */);
1:is(.button, button):hover { 2 order: 7; 3}
Becomes :
1.button:hover { 2 order: 7; 3} 4 5button:not(.something-random):hover { 6 order: 7; 7}
Warn on complex selectors in :is
pseudo class functions.
1postcss([ 2 postcssIsPseudoClass({ onComplexSelector: 'warning' }) 3]).process(YOUR_CSS /*, processOptions */);
Warn when pseudo elements are used in :is
pseudo class functions.
⚠️ Pseudo elements are always invalid and will be transformed to ::-csstools-invalid-<pseudo-name>
.
1postcss([ 2 postcssIsPseudoClass({ onPseudoElement: 'warning' }) 3]).process(YOUR_CSS /*, processOptions */);
1:is(::after):hover { 2 order: 1.0; 3} 4 5/* becomes */ 6 7::-csstools-invalid-after:hover { 8 order: 1.0; 9}
:is
takes the specificity of the most specific list item.
We can increase specificity with :not
selectors, but we can't decrease it.
Converted selectors are ensured to have the same specificity as :is
for the most important bit.
Less important bits can have higher specificity that :is
.
Before :
1:is(:hover, :focus):is(.button, button) { 2 order: 7; 3}
After :
1/* specificity: [0, 2, 0] */ 2.button:hover { 3 order: 7; 4} 5 6/* specificity: [0, 2, 1] */ 7/* last bit is higher than it should be, but middle bit matches */ 8button:not(.does-not-exist):hover { 9 order: 7; 10} 11 12/* specificity: [0, 2, 0] */ 13.button:focus { 14 order: 7; 15} 16 17/* specificity: [0, 2, 1] */ 18/* last bit is higher than it should be, but middle bit matches */ 19button:not(.does-not-exist):focus { 20 order: 7; 21}
Before :
1:is(.alpha > .beta) ~ :is(:focus > .beta) { 2 order: 2; 3}
After :
1.alpha > .beta ~ :focus > .beta { 2 order: 2; 3}
this is a different selector than expected as .beta ~ :focus
matches .beta
followed by :focus
.
avoid these cases.
writing the selector without :is()
is advised here
1/* without is */ 2.alpha:focus > .beta ~ .beta { 3 order: 2; 4}
If you have a specific pattern you can open an issue to discuss it. We can detect and transform some cases but can't generalize them into a single solution that tackles all of them.
No vulnerabilities found.
Reason
30 commit(s) and 7 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
1 existing vulnerabilities detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 1/24 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More