postcss-selector-parser
> Selector parser with built in methods for working with selector strings.
Last updated 2 years ago by evilebottnawi .
MIT · Repository · Bugs · Original npm
$ cnpm install postcss-selector-parser 
SYNC missed versions from official npm registry.

postcss-selector-parser Build Status

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

Current Tags

  • 6.0.13                                ...           latest (2 years ago)
  • 5.0.0-rc.1                                ...           next (7 years ago)

13 Versions

  • 6.0.13                                ...           2 years ago
  • 6.0.11                                ...           3 years ago
  • 6.0.10                                ...           3 years ago
  • 6.0.9                                ...           4 years ago
  • 6.0.8                                ...           4 years ago
  • 6.0.6                                ...           4 years ago
  • 6.0.4                                ...           5 years ago
  • 5.0.0-rc.1                                ...           7 years ago
  • 5.0.0                                ...           7 years ago
  • 1.3.3                                ...           9 years ago
  • 2.2.3                                ...           9 years ago
  • 3.1.2                                ...           6 years ago
  • 6.0.2                                ...           6 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (19)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org