css-customproperties-parser
Parser css custom properties into JS object.
Api
const CSSParser = path = CSS_FILE_PATH = path; const CSSobject = CSSParser;console; // this is result object
CSS variable file has to be this structure, same name properties will be overwritten:
Output:
var result = 'color-divider': 'var(--palette-grey-200)' 'color-background': 'var(--color-white)' 'color-text': 'var(--palette-grey-900)' 'color-text-secondary': 'var(--palette-grey-600)' 'color-primary': 'var(--palette-red-600)' 'color-primary-dark': 'var(--palette-red-900)' 'color-accent': 'var(--palette-teal-500)' 'color-accent-dark': 'var(--palette-teal-900)' 'color-primary-contrast': 'var(--color-dark-contrast)' 'color-accent-contrast': 'var(--color-dark-contrast)'