Fix the Using / for division outside of calc() is deprecated
Question:
How to fix the Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.? Answer:
@use "sass:math";
math.div($gutter / 3);
// OR simply
calc($gutter / 3);
Description:
In future new versions of sass, you will not be able to use slash as a division except for the calc()
function. Current sass compilers such as dart-sass warn about this with the following warning message:
Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div($gutter, 3) or calc($gutter / 3)
More info and automated migrator: https://sass-lang.com/d/slash-div
You have two options to deal with the problem:
- Use the
math
module and themath.div()
function:
@use "sass:math"; math.div($gutter / 3);
- Use the old
calc()
function:
calc($gutter / 3);
Reference:
Breaking changes in sass
Share "How to fix the Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.?"
Related snippets:
Tags:
deprecation, warning, sass, scss, division, calc, removed Technical term:
Fix the Using / for division outside of calc() is deprecated waring