css_variable_utils.ts view source
(css: string): Set<string> Extracts CSS variable names from a CSS string.
Parses var(--name) patterns and returns the variable names
without the -- prefix. Handles fallback values by extracting
only the primary variable reference.
css
CSS string potentially containing var(--*) references
stringreturns
Set<string> set of variable names (without -- prefix)
examples
extract_css_variables('color: var(--text_color);')
// → Set { 'text_color' }
extract_css_variables('background: var(--bg_1, var(--bg_2));')
// → Set { 'bg_1', 'bg_2' }
extract_css_variables('padding: 1rem;')
// → Set {}