From c3075d97fe044bb47246e68445187c4a7bed1d15 Mon Sep 17 00:00:00 2001 From: Ari Seyhun Date: Thu, 1 Aug 2019 12:57:46 +0930 Subject: [PATCH] Add support for negative css custom properties --- src/util/resolveConfig.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/resolveConfig.js b/src/util/resolveConfig.js index 3667f35bd..bda17223d 100644 --- a/src/util/resolveConfig.js +++ b/src/util/resolveConfig.js @@ -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]}`, }), {} )