Add support for negative css custom properties

This commit is contained in:
Ari Seyhun 2019-08-01 12:57:46 +09:30
parent 7877ffab8a
commit c3075d97fe

View File

@ -3,6 +3,7 @@ import isFunction from 'lodash/isFunction'
import defaults from 'lodash/defaults'
import map from 'lodash/map'
import toPath from 'lodash/toPath'
import startsWith from 'lodash/startsWith'
const configUtils = {
negative(scale) {
@ -11,7 +12,9 @@ const configUtils = {
.reduce(
(negativeScale, key) => ({
...negativeScale,
[`-${key}`]: `-${scale[key]}`,
[`-${key}`]: startsWith(scale[key], 'var(')
? `calc(${scale[key]} * -1)`
: `-${scale[key]}`,
}),
{}
)