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 May 25, 2021
1 parent b513a19 commit 50cf7f4
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 @@ -181,6 +181,14 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
@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 @@ -201,5 +209,13 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
@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 50cf7f4

Please sign in to comment.