From ca3ff6dc29df09bb77321eacfb072be8c48c0c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Poupard?= Date: Tue, 25 May 2021 07:23:41 +0200 Subject: [PATCH] Handle complex expressions in add() & subtract() (#34047) --- scss/_functions.scss | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scss/_functions.scss b/scss/_functions.scss index 9c06603150..8abc31164e 100644 --- a/scss/_functions.scss +++ b/scss/_functions.scss @@ -120,6 +120,14 @@ @return $value1 + $value2; } + @if type-of($value1) != number { + $value1: unquote("(") + $value1 + unquote(")"); + } + + @if type-of($value2) != number { + $value2: unquote("(") + $value2 + unquote(")"); + } + @return if($return-calc == true, calc(#{$value1} + #{$value2}), $value1 + unquote(" + ") + $value2); } @@ -140,5 +148,13 @@ @return $value1 - $value2; } + @if type-of($value1) != number { + $value1: unquote("(") + $value1 + unquote(")"); + } + + @if type-of($value2) != number { + $value2: unquote("(") + $value2 + unquote(")"); + } + @return if($return-calc == true, calc(#{$value1} - #{$value2}), $value1 + unquote(" - ") + $value2); }