postcss-selector-not
TypeScript icon, indicating that this package has built-in type declarations

7.0.2 • Public • Published

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:

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i postcss-selector-not

    Weekly Downloads

    5,217,435

    Version

    7.0.2

    License

    MIT

    Unpacked Size

    7.53 kB

    Total Files

    7

    Last publish

    Collaborators

    • romainmenke
    • alaguna
    • jonathantneal
    • moox
    • semigradsky