foundation / motion-ui

💎 The powerful Sass library for creating CSS transitions and animations
https://zurb.com/playground/motion-ui
MIT License
1.16k stars 174 forks source link

Dart/Node SASS has deprecated / as division operator #139

Closed htemele closed 2 years ago

htemele commented 2 years ago

Hi,

As the title says, the '/' is in dart-sass 2.0 onwards only a separator. Right now it has been deprecated and will be removed in version 2.

It seems that function is not used anywhere in the codebase... it's safely to remove?

Deprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($num, $num * 0 + 1)

More info and automated migrator: https://sass-lang.com/d/slash-div

  ╷
6 │   @return $num / ($num * 0 + 1);
  │           ^^^^^^^^^^^^^^^^^^^^^
  ╵
    node_modules/motion-ui/src/util/_unit.scss 6:11                  strip-unit()
    node_modules/foundation-sites/scss/util/_unit.scss 95:20         -zf-to-rem()
    node_modules/foundation-sites/scss/util/_unit.scss 51:13         rem-calc()
    node_modules/foundation-sites/scss/util/_unit.scss 65:13         -zf-bp-to-em()
    node_modules/foundation-sites/scss/util/_breakpoint.scss 204:31  -zf-bp-serialize()
    node_modules/foundation-sites/scss/_global.scss 145:21           foundation-global-styles()
    src/assets/scss/app.scss 8:1                                     root stylesheet
kierrapalmer commented 2 years ago

Manually applying the proposed pull request gave me an error when compiling

Error: Undefined operation "calc(0 / (0 * 0 + 1)) > 0". in node_modules/foundation-sites/scss/util/_math.scss

I ran the sass-migrator tool instead and it applied this change instead:

@use "sass:math";

@function strip-unit($num) {
    @return math.div($num, $num * 0 + 1);
} 

Everything worked afterwords

joeworkman commented 2 years ago

All fixed in https://github.com/foundation/motion-ui/releases/tag/v2.0.4