How to use the css-selector-tokenizer.parseValues 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 css-modules / postcss-icss-selectors / index.js View on Github external
function localizeDecl(decl, context) {
  var valuesNode = Tokenizer.parseValues(decl.value);
  var localizeName = /animation(-name)?$/.test(decl.prop);
  var newValuesNode = Object.create(valuesNode);
  newValuesNode.nodes = valuesNode.nodes.map(function(valueNode) {
    var subContext = {
      options: context.options,
      global: context.global,
      localizeNextItem: localizeName && !context.global
    };
    return localizeDeclValue(valueNode, subContext);
  });
  decl.value = Tokenizer.stringifyValues(newValuesNode);
}
github sx1989827 / DOClever / node_modules / css-loader / lib / processCss.js View on Github external
css.walkAtRules(/^import$/i, function(rule) {
				var values = Tokenizer.parseValues(rule.params);
				var url = values.nodes[0].nodes[0];
				if(url && url.type === "url") {
					url = url.url;
				} else if(url && url.type === "string") {
					url = url.value;
				} else throw rule.error("Unexpected format " + rule.params);
				if (!url.replace(/\s/g, '').length) {
					return;
				}
				values.nodes[0].nodes.shift();
				var mediaQuery = Tokenizer.stringifyValues(values);

				if(loaderUtils.isUrlRequest(url, options.root)) {
					url = loaderUtils.urlToRequest(url, options.root);
				}
github willurmston / Tone.Editor / node_modules / css-loader / lib / processCss.js View on Github external
css.walkDecls(function(decl) {
			var values = Tokenizer.parseValues(decl.value);
			values.nodes.forEach(function(value) {
				value.nodes.forEach(processNode);
			});
			decl.value = Tokenizer.stringifyValues(values);
		});
		css.walkAtRules(function(atrule) {
github zubairghori / Ultimate_todo_list / node_modules / css-loader / lib / processCss.js View on Github external
css.walkAtRules(/^import$/i, function(rule) {
				var values = Tokenizer.parseValues(rule.params);
				var url = values.nodes[0].nodes[0];
				if(url && url.type === "url") {
					url = url.url;
				} else if(url && url.type === "string") {
					url = url.value;
				} else throw rule.error("Unexpected format " + rule.params);
				if (!url.replace(/\s/g, '').length) {
					return;
				}
				values.nodes[0].nodes.shift();
				var mediaQuery = Tokenizer.stringifyValues(values);
				if(loaderUtils.isUrlRequest(url, options.root) && options.mode === "global") {
					url = loaderUtils.urlToRequest(url, options.root);
				}
				importItems.push({
					url: url,
github sx1989827 / DOClever / Desktop / node_modules / css-loader / lib / processCss.js View on Github external
css.walkAtRules(/^import$/i, function(rule) {
				var values = Tokenizer.parseValues(rule.params);
				var url = values.nodes[0].nodes[0];
				if(url && url.type === "url") {
					url = url.url;
				} else if(url && url.type === "string") {
					url = url.value;
				} else throw rule.error("Unexpected format " + rule.params);
				if (!url.replace(/\s/g, '').length) {
					return;
				}
				values.nodes[0].nodes.shift();
				var mediaQuery = Tokenizer.stringifyValues(values);
				if(loaderUtils.isUrlRequest(url, options.root) && options.mode === "global") {
					url = loaderUtils.urlToRequest(url, options.root);
				}
				importItems.push({
					url: url,
github markfinger / unfort / compiler / postcss_ast_dependencies.js View on Github external
function getDependencyIdentifiersFromDeclarationValue(value) {
    const node = css_selector_tokenizer_1.parseValues(value);
    const accum = [];
    findUrlsInNode(node, accum);
    return accum;
}
exports.getDependencyIdentifiersFromDeclarationValue = getDependencyIdentifiersFromDeclarationValue;
github fossasia / susper.com / node_modules / css-loader / lib / processCss.js View on Github external
css.walkAtRules(/^import$/i, function(rule) {
				var values = Tokenizer.parseValues(rule.params);
				var url = values.nodes[0].nodes[0];
				if(url && url.type === "url") {
					url = url.url;
				} else if(url && url.type === "string") {
					url = url.value;
				} else throw rule.error("Unexpected format " + rule.params);
				if (!url.replace(/\s/g, '').length) {
					return;
				}
				values.nodes[0].nodes.shift();
				var mediaQuery = Tokenizer.stringifyValues(values);
				if(loaderUtils.isUrlRequest(url, options.root) && options.mode === "global") {
					url = loaderUtils.urlToRequest(url, options.root);
				}
				importItems.push({
					url: url,
github elastic / timelion / node_modules / css-loader / lib / processCss.js View on Github external
css.eachAtRule("import", function(rule) {
			var values = Tokenizer.parseValues(rule.params);
			var url = values.nodes[0].nodes[0];
			if(url.type === "url") {
				url = url.url;
			} else if(url.type === "string") {
				url = url.value;
			} else throw rule.error("Unexpected format" + rule.params);
			values.nodes[0].nodes.shift();
			var mediaQuery = Tokenizer.stringifyValues(values);
			if(loaderUtils.isUrlRequest(url, options.root) && options.mode === "global") {
				url = loaderUtils.urlToRequest(url, options.root);
			}
			importItems.push({
				url: url,
				mediaQuery: mediaQuery
			});
			rule.removeSelf();
github wix / stylable / packages / core / src / stylable-assets.ts View on Github external
export function processDeclarationUrls(
    decl: postcss.Declaration,
    onUrl: OnUrlCallback,
    transform: boolean
) {
    const ast = parseValues(decl.value);
    ast.nodes.forEach((node: ParsedValue) => {
        node.nodes!.forEach((node: ParsedValue) => findUrls(node, onUrl));
    });
    if (transform) {
        decl.value = stringifyValues(ast);
    }
}
github markfinger / unfort / src / postcss-ast-dependencies / postcss-ast-dependencies.js View on Github external
export function getDependencyIdentifiersFromDeclarationValue(string) {
  const node = cssSelectorTokenizer.parseValues(string);
  const accum = [];

  findUrlsInNode(node, accum);

  return accum;
}

css-selector-tokenizer

Parses and stringifies CSS selectors

MIT
Latest version published 4 years ago

Package Health Score

71 / 100
Full package analysis