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
Size: 455
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Selector parser with built in methods for working with selector strings.
With npm do:
install postcss-selector-parser
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.
Please see API.md.
MIT