How to use the postcss-selector-parser.SELECTOR function in postcss-selector-parser

To help you get started, we’ve selected a few postcss-selector-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github youzan / zent / packages / zent / plugins / postcss-plugin-version-attribute.js View on Github external
selectors.each(selector => {
    if (selector.type === parseSelector.SELECTOR) {
      // Must contain at least one class or id
      // body.foobar, html.foobar are not handled as they won't appear in a library
      let skip = true;
      selector.walk(node => {
        const { type } = node;
        if (type === parseSelector.CLASS || type === parseSelector.ID) {
          skip = false;
        }
      });
      if (skip) {
        return;
      }

      // Insert a [data-zv=x.y.z] after the first class/attribute/id/tag
      let interestedNode = null;
      selector.walk(node => {
github linkedin / opticss / packages / opticss / src / Match / ElementMatcher.ts View on Github external
export function isSelector(node: { type: string } | undefined): node is SelectorParser.Selector {
  if (node) {
    return node.type === SelectorParser.SELECTOR;
  } else {
    return false;
  }
}