postcss-selector-parser (6.1.2)

Published 2026-02-24 14:03:22 +00:00 by atheaadmin

Installation

registry=
npm install postcss-selector-parser@6.1.2
"postcss-selector-parser": "6.1.2"

About this package

postcss-selector-parser test

Selector parser with built in methods for working with selector strings.

Install

With npm do:

npm install postcss-selector-parser

Quick Start

const parser = require('postcss-selector-parser');
const transform = selectors => {
    selectors.walk(selector => {
        // do something with the selector
        console.log(String(selector))
    });
};

const transformed = parser(transform).processSync('h1, h2, h3');

To normalize selector whitespace:

const parser = require('postcss-selector-parser');
const normalized = parser().processSync('h1, h2, h3', {lossless: false});
// -> h1,h2,h3

Async support is provided through parser.process and will resolve a Promise with the resulting selector string.

API

Please see API.md.

Credits

  • Huge thanks to Andrey Sitnik (@ai) for work on PostCSS which helped accelerate this module's development.

License

MIT

Dependencies

Dependencies

ID Version
cssesc ^3.0.0
util-deprecate ^1.0.2

Development Dependencies

ID Version
@babel/cli ^7.11.6
@babel/core ^7.11.6
@babel/eslint-parser ^7.11.5
@babel/eslint-plugin ^7.11.5
@babel/plugin-proposal-class-properties ^7.10.4
@babel/preset-env ^7.11.5
@babel/register ^7.11.5
ava ^5.1.0
babel-plugin-add-module-exports ^1.0.4
coveralls ^3.1.0
del-cli ^5.0.0
eslint ^8.28.0
eslint-plugin-import ^2.26.0
glob ^8.0.3
minimist ^1.2.5
nyc ^15.1.0
postcss ^8.4.31
semver ^7.3.2
typescript ^4.0.3
Details
npm
2026-02-24 14:03:22 +00:00
0
MIT
42 KiB
Assets (1)
Versions (2) View all
7.1.0 2026-02-24
6.1.2 2026-02-24