Skip to content

Commit

Permalink
Handle complex expressions in add() & subtract() (#34047)
Browse files Browse the repository at this point in the history
  • Loading branch information
ffoodd authored and XhmikosR committed Jun 24, 2021
1 parent d840ada commit 66c3d05
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions scss/_functions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

0 comments on commit 66c3d05

Please sign in to comment.