postcss-selector-parser
postcss-selector-parser copied to clipboard
A CSS selector parser, integrates with postcss but does not require it.
Repro: ``` test('Sass selector', '.#{$classname}', (t, tree) => { const node = tree.nodes[0].nodes[0]; t.deepEqual(node.type, "class"); // Ok t.deepEqual(node.value, "#{$classname}"); // Ok t.deepEqual(node.source.start.column, 1); // Fail. Received: 5 t.deepEqual(node.source.end.column, 14); //...
Hello. My builds, which use the mini-css-extract-plugin, fail when I attempt to use wildcard attribute selectors, like `[class^="foo"]` or `[class*="bar"]`. Is this a known issue?
I'm on the latest published version and there aren't any exposed types to import?
Include: - Remove old/unnecessary stuff - Increase coverage - Refactor and fixes error message ~~No breaking changes~~ (wrong)
https://github.com/postcss/postcss-selector-parser/blob/master/API.md --- - [ ] Node - appendToPropertyAndEscape - setPropertyAndEscape - setPropertyWithoutEscape - valueToString - stringifyProperty - argument in `clone`? - [ ] Guard functions: `isAttribute`, `isClassName`, ..., etc
Context: https://github.com/cssnano/cssnano/pull/925 ```js console.log(require('postcss-selector-parser')().processSync('[ foo | bar ]')); '[ foo ]' ``` Expected output: `[ foo | bar ]`. Interestingly, it does work when removing some of the whitespace around...
One thing I would find very useful is the ability to check if two selectors are semantically equal. I'm currently comparing the string representations of selectors, but that doesn't capture...
```bash require('postcss-selector-parser')().processSync('[#{$Keep}]') ``` should be ```diff -'[#{Keep}]' +'[#{$Keep}]' ```