postcss/postcss-selector-parser

Name: postcss-selector-parser

Owner: PostCSS

Description: A CSS selector parser, integrates with postcss but does not require it.

Created: 2015-05-29 11:24:37.0

Updated: 2018-05-22 09:44:25.0

Pushed: 2018-05-14 21:50:55.0

Homepage:

Size: 455

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

postcss-selector-parser Build Status

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

Install

With npm do:

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


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

To normalize selector whitespace:

t parser = require('postcss-selector-parser');
t 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
License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.