We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0a0b477 + 148b717 commit 1d44ef6Copy full SHA for 1d44ef6
src/index.test.ts
@@ -44,12 +44,18 @@ describe('Custom Properties', () => {
44
toCustomPropertiesArray({
45
strongBlack: { 100: '#999999', 900: '#000000' },
46
strongWhite: { 100: '#ffffff', 900: '#aaaaaa' },
47
+ black: { primary: '#000000', secondaryLight: '#111111' },
48
+ white: { primary: '#ffffff', secondaryDark: '#eeeeee' },
49
})
50
).toEqual([
51
{ key: '--strong-black-100', value: '#999999' },
52
{ key: '--strong-black-900', value: '#000000' },
53
{ key: '--strong-white-100', value: '#ffffff' },
54
{ key: '--strong-white-900', value: '#aaaaaa' },
55
+ { key: '--black-primary', value: '#000000' },
56
+ { key: '--black-secondary-light', value: '#111111' },
57
+ { key: '--white-primary', value: '#ffffff' },
58
+ { key: '--white-secondary-dark', value: '#eeeeee' },
59
])
60
61
src/index.ts
@@ -37,7 +37,9 @@ const toCSSVariables = (object: CSSObject, options?: Options) => {
37
addCSSVariable(value, [...parentKeys, paramCase(key)])
38
} else {
39
cssVariables.push({
40
- key: `--${(options && options.prefix && `${options.prefix}-`) || ''}${[...parentKeys, key].join('-')}`,
+ key: `--${(options && options.prefix && `${options.prefix}-`) || ''}${[...parentKeys, paramCase(key)].join(
41
+ '-'
42
+ )}`,
43
value,
}
0 commit comments