@@ -65,6 +65,9 @@ function convertMathExpression(node, precision) {
6565function reduceAddSubExpression ( node , precision ) {
6666 const { left, right, operator : op } = node
6767
68+ if ( left . type === 'CssVariable' || right . type === 'CssVariable' )
69+ return node
70+
6871 // something + 0 => something
6972 // something - 0 => something
7073 if ( right . value === 0 )
@@ -125,7 +128,7 @@ function reduceAddSubExpression(node, precision) {
125128 // (expr) <op> value
126129 if (
127130 left . type === 'MathExpression' &&
128- ( left . operator === '+' || left . operator === '-' ) &&
131+ ( left . operator === '+' || left . operator === '-' ) &&
129132 isValueType ( right . type )
130133 ) {
131134 // (value + something) + value => (value + value) + something
@@ -176,7 +179,7 @@ function reduceAddSubExpression(node, precision) {
176179}
177180
178181function reduceDivisionExpression ( node ) {
179- if ( node . right . type === 'MathExpression' )
182+ if ( ! isValueType ( node . right . type ) )
180183 return node
181184
182185 if ( node . right . type !== 'Value' )
@@ -188,7 +191,7 @@ function reduceDivisionExpression(node) {
188191 // (expr) / value
189192 if ( node . left . type === 'MathExpression' ) {
190193 if (
191- isValueType ( node . left . left . type ) &&
194+ isValueType ( node . left . left . type ) &&
192195 isValueType ( node . left . right . type )
193196 ) {
194197 node . left . left . value /= node . right . value
0 commit comments