Search code examples
sasssass-loader

WARNING: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0


After I've updated my Angular application, and by doing so also updated Sass compiler I started getting this error

$val: 100px;

.some-sellector {
  padding: $val / 2;
}
WARNING: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.


Solution

  • Dart Sass compiler had some changes. Now to use division inside *.scss file you need to use the methods: math.div(value, divider) or calc(value / 2).

    However, I found it easier to use multiplication with decimal number:

      padding: $val * 0.5;