diff options
author | thingsym <thingsym@gmail.com> | 2021-11-21 10:34:11 +0300 |
---|---|---|
committer | thingsym <thingsym@gmail.com> | 2021-11-21 10:34:11 +0300 |
commit | 3ff336b938f46af8e2bab0830c5df3b41a634447 (patch) | |
tree | aebc6e9051cb47528e4312f02f1e2e23e9dc68c6 /src/scss | |
parent | 21f94d8a1de20c41852fc82513f63d1c28e849e7 (diff) |
fix: change to using math.div for division
Deprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Diffstat (limited to 'src/scss')
-rw-r--r-- | src/scss/function/_calc-font-size.scss | 16 | ||||
-rw-r--r-- | src/scss/function/_calc-stack.scss | 4 | ||||
-rw-r--r-- | src/scss/function/_strip-unit.scss | 2 |
3 files changed, 14 insertions, 8 deletions
diff --git a/src/scss/function/_calc-font-size.scss b/src/scss/function/_calc-font-size.scss index 1e54885..6be78b5 100644 --- a/src/scss/function/_calc-font-size.scss +++ b/src/scss/function/_calc-font-size.scss @@ -1,5 +1,9 @@ @charset "utf-8"; +// Built-In Modules +@use 'sass:math'; + +// Included Modules @use 'strip-unit'; // =================================================================== @@ -7,18 +11,20 @@ // =================================================================== @function px2em($px, $base: 16) { - @return strip-unit.strip-unit($px) / strip-unit.strip-unit($base) * 1em; + @return math.div(strip-unit.strip-unit($px), strip-unit.strip-unit($base)) * 1em; + } @function px2rem($px, $base: 16) { - @return strip-unit.strip-unit($px) / strip-unit.strip-unit($base) * 1rem; + @return math.div(strip-unit.strip-unit($px), strip-unit.strip-unit($base)) * 1rem; } + // =================================================================== // percent to px // =================================================================== @function percent2px($percent, $base: 16) { - @return strip-unit.strip-unit($base) * (strip-unit.strip-unit($percent) / 100) * 1px; + @return strip-unit.strip-unit($base) * math.div(strip-unit.strip-unit($percent), 100) * 1px; } // =================================================================== @@ -26,11 +32,11 @@ // =================================================================== @function percent2em($percent, $base: 16) { - @return (strip-unit.strip-unit($base) * (strip-unit.strip-unit($percent) / 100)) / strip-unit.strip-unit($base) * 1em; + @return math.div(strip-unit.strip-unit($base) * math.div(strip-unit.strip-unit($percent), 100), strip-unit.strip-unit($base)) * 1em; } @function percent2rem($percent, $base: 16) { - @return (strip-unit.strip-unit($base) * (strip-unit.strip-unit($percent) / 100)) / strip-unit.strip-unit($base) * 1rem; + @return math.div(strip-unit.strip-unit($base) * math.div(strip-unit.strip-unit($percent), 100), strip-unit.strip-unit($base)) * 1rem; } // =================================================================== diff --git a/src/scss/function/_calc-stack.scss b/src/scss/function/_calc-stack.scss index cb9f05e..4ea3805 100644 --- a/src/scss/function/_calc-stack.scss +++ b/src/scss/function/_calc-stack.scss @@ -9,7 +9,7 @@ @function stack($line-height: 1, $font-size: 16px, $base: 16px) { $line-height: strip-unit.strip-unit($line-height) * strip-unit.strip-unit($base); - @return $line-height / strip-unit.strip-unit($font-size) * 1rem; + @return math.div($line-height, strip-unit.strip-unit($font-size)) * 1rem; } @function line-height($line-space: 4px, $font-size: 16px, $base: 16px) { @@ -24,5 +24,5 @@ $font-size: strip-unit.strip-unit($font-size); $line-space: strip-unit.strip-unit($line-space); - @return (($line-space * 2) + $font-size) / $font-size; + @return math.div($line-space * 2 + $font-size, $font-size); } diff --git a/src/scss/function/_strip-unit.scss b/src/scss/function/_strip-unit.scss index 99794b6..dd93185 100644 --- a/src/scss/function/_strip-unit.scss +++ b/src/scss/function/_strip-unit.scss @@ -6,7 +6,7 @@ @function strip-unit($value) { @if meta.type-of($value) == 'number' and math.is-unitless($value) == false { - @return $value / ($value * 0 + 1); + @return math.div($value, $value * 0 + 1); } @else if meta.type-of($value) == 'number' { @return $value; } @else { |