MCPcopy Create free account
hub / github.com/webstudio-is/webstudio / collectRuleCustomProperties

Function collectRuleCustomProperties

packages/css-data/src/parse-css.ts:725–740  ·  view source on GitHub ↗
(rule: csstree.Rule)

Source from the content-addressed store, hash-verified

723 const customProperties = new Map<string, string>();
724
725 const collectRuleCustomProperties = (rule: csstree.Rule) => {
726 customProperties.clear();
727 csstree.walk(rule, {
728 visit: "Declaration",
729 enter(node) {
730 const decl = node as csstree.Declaration;
731 const prop = normalizeProperty(decl.property);
732 if (prop.startsWith("--")) {
733 const value = getRawDeclarationValue(css, decl);
734 if (value !== undefined && isValidCustomPropertyValue(value)) {
735 customProperties.set(prop, normalizeCustomPropertyValue(value));
736 }
737 }
738 },
739 });
740 };
741
742 csstree.walk(ast, {
743 enter(node) {

Callers 1

enterFunction · 0.85

Calls 1

clearMethod · 0.80

Tested by

no test coverage detected