Skip to content

Commit c3075d9

Browse files
Ari SeyhunAri Seyhun
authored andcommitted
Add support for negative css custom properties
1 parent 7877ffa commit c3075d9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/util/resolveConfig.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import isFunction from 'lodash/isFunction'
33
import defaults from 'lodash/defaults'
44
import map from 'lodash/map'
55
import toPath from 'lodash/toPath'
6+
import startsWith from 'lodash/startsWith'
67

78
const configUtils = {
89
negative(scale) {
@@ -11,7 +12,9 @@ const configUtils = {
1112
.reduce(
1213
(negativeScale, key) => ({
1314
...negativeScale,
14-
[`-${key}`]: `-${scale[key]}`,
15+
[`-${key}`]: startsWith(scale[key], 'var(')
16+
? `calc(${scale[key]} * -1)`
17+
: `-${scale[key]}`,
1518
}),
1619
{}
1720
)

0 commit comments

Comments
 (0)