Skip to content

Commit

Permalink
Add support for negative css custom properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Ari Seyhun authored and Ari Seyhun committed Aug 1, 2019
1 parent 7877ffa commit c3075d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/util/resolveConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -11,7 +12,9 @@ const configUtils = {
.reduce(
(negativeScale, key) => ({
...negativeScale,
[`-${key}`]: `-${scale[key]}`,
[`-${key}`]: startsWith(scale[key], 'var(')
? `calc(${scale[key]} * -1)`
: `-${scale[key]}`,
}),
{}
)
Expand Down

0 comments on commit c3075d9

Please sign in to comment.