CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
1# postcss-selector-parser [![Build Status](https://travis-ci.org/postcss/postcss-selector-parser.svg?branch=master)](https://travis-ci.org/postcss/postcss-selector-parser)2 3> Selector parser with built in methods for working with selector strings.4 5## Install6 7With [npm](https://npmjs.com/package/postcss-selector-parser) do:8 9```10npm install postcss-selector-parser11```12 13## Quick Start14 15```js16const parser = require('postcss-selector-parser');17const transform = selectors => {18    selectors.walk(selector => {19        // do something with the selector20        console.log(String(selector))21    });22};23 24const transformed = parser(transform).processSync('h1, h2, h3');25```26 27To normalize selector whitespace:28 29```js30const parser = require('postcss-selector-parser');31const normalized = parser().processSync('h1, h2, h3', {lossless: false});32// -> h1,h2,h333```34 35Async support is provided through `parser.process` and will resolve a Promise36with the resulting selector string.37 38## API39 40Please see [API.md](API.md).41 42## Credits43 44* Huge thanks to Andrey Sitnik (@ai) for work on PostCSS which helped45  accelerate this module's development.46 47## License48 49MIT50