1. postcss-selector-not
PostCSS plugin to transform :not() W3C CSS level 4 pseudo class to :not() CSS level 3 selectors
postcss-selector-not
Package: postcss-selector-not
Created by: csstools
Last modified: Mon, 19 Feb 2024 21:50:34 GMT
Version: 7.0.2
License: MIT
Downloads: 25,752,308
Repository: https://github.com/csstools/postcss-plugins

Install

npm install postcss-selector-not
yarn add postcss-selector-not

PostCSS Selector Not PostCSS Logo

npm version Build Status Discord

Baseline Status CSS Standard Status

 npm install postcss-selector-not --save-dev

PostCSS Selector Not transforms :not() W3C CSS level 4 pseudo classes to :not() CSS level 3 selectors following the Selectors 4 Specification.

p:not(:first-child, .special) {
	color: red;
}

/* becomes */

p:not(:first-child):not(.special) {
	color: red;
}

[!CAUTION]
Only lists of simple selectors (:not(.a, .b)) will work as expected.
Complex selectors (:not(.a > .b, .c ~ .d)) can not be downgraded.

Usage

Add PostCSS Selector Not to your project:

 npm install postcss postcss-selector-not --save-dev

Use it as a PostCSS plugin:

 const postcss = require('postcss');
const postcssSelectorNot = require('postcss-selector-not');

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

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

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code