How to use the css-selector-tokenizer.stringify function in css-selector-tokenizer

To help you get started, we’ve selected a few css-selector-tokenizer 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 wix / stylable / packages / core / src / selector-utils.ts View on Github external
export function stringifySelector(ast: SelectorAstNode): string {
    return tokenizer.stringify(ast);
}
github joshwnj / cmz / lib / scope-classnames.js View on Github external
function localizeRule (rule) {
    const selector = Tokenizer.parse(rule.selector)
    let scopedSelector

    try {
      scopedSelector = localizeNode(selector)
    } catch (e) {
      throw rule.error(e.message)
    }

    rule.selector = Tokenizer.stringify(scopedSelector)
  }
github css-modules / postcss-icss-selectors / src / index.js View on Github external
const localizeSelectors = (selectors, mode, getAlias) => {
  const node = Tokenizer.parse(selectors);
  return Tokenizer.stringify(
    Object.assign({}, node, {
      nodes: node.nodes.map(n => localizeNode(n, { mode, getAlias }))
    })
  );
};
github css-modules / postcss-icss-selectors / index.js View on Github external
newNodes = node.nodes.map(function(n) {
        var nContext = {
          global: context.global,
          lastWasSpacing: true,
          hasLocals: false,
          explicit: false
        };
        n = localizeNode(n, nContext);
        if(typeof resultingGlobal === 'undefined') {
          resultingGlobal = nContext.global;
        } else if(resultingGlobal !== nContext.global) {
          throw new Error('Inconsistent rule global/local result in rule "' +
            Tokenizer.stringify(node) + '" (multiple selectors must result in the same mode for the rule)');
        }
        if(!nContext.hasLocals) {
          context.hasPureGlobals = true;
        }
        return n;
      });
      context.global = resultingGlobal;
github sx1989827 / DOClever / Client / node_modules / postcss-modules-local-by-default / index.js View on Github external
newNodes = node.nodes.map(function(n) {
        var nContext = {
          global: context.global,
          lastWasSpacing: true,
          hasLocals: false,
          explicit: false
        };
        n = localizeNode(n, nContext);
        if(typeof resultingGlobal === 'undefined') {
          resultingGlobal = nContext.global;
        } else if(resultingGlobal !== nContext.global) {
          throw new Error('Inconsistent rule global/local result in rule "' +
            Tokenizer.stringify(node) + '" (multiple selectors must result in the same mode for the rule)');
        }
        if(!nContext.hasLocals) {
          context.hasPureGlobals = true;
        }
        return n;
      });
      context.global = resultingGlobal;
github decentraland / editor-legacy / node_modules / postcss-modules-local-by-default / index.js View on Github external
newNodes = node.nodes.map(function(n) {
        var nContext = {
          global: context.global,
          lastWasSpacing: true,
          hasLocals: false,
          explicit: false
        };
        n = localizeNode(n, nContext);
        if(typeof resultingGlobal === 'undefined') {
          resultingGlobal = nContext.global;
        } else if(resultingGlobal !== nContext.global) {
          throw new Error('Inconsistent rule global/local result in rule "' +
            Tokenizer.stringify(node) + '" (multiple selectors must result in the same mode for the rule)');
        }
        if(!nContext.hasLocals) {
          context.hasPureGlobals = true;
        }
        return n;
      });
      context.global = resultingGlobal;
github wix / stylable / src / selector-utils.ts View on Github external
export function stringifySelector(ast: SelectorAstNode): string {
    return tokenizer.stringify(ast)
}
github ant-design / ant-design-pro-site / config / components / tool / AddlocalIdentName.js View on Github external
const localizeSelectors = (selectors, mode, getAlias) => {
  const node = Tokenizer.parse(selectors);
  return Tokenizer.stringify(
    Object.assign({}, node, {
      nodes: node.nodes.map(n => localizeNode(n, { mode, getAlias })),
    })
  );
};
const getValue = (messages, name) =>

css-selector-tokenizer

Parses and stringifies CSS selectors

MIT
Latest version published 3 years ago

Package Health Score

71 / 100
Full package analysis