at-import / SassyLists

MIT License
276 stars 27 forks source link

fix: fix libsass 4 call deprecation warning #63 #65

Open ncoden opened 6 years ago

ncoden commented 6 years ago

Fix the following deprecation warning:

DEPRECATION WARNING: Passing a string to call() is deprecated and will be illegal
in Sass 4.0. Use call(get-function("fade")) instead.

Call call() with a function retrieved by the new function get-function.

Changes:

Closes https://github.com/at-import/SassyLists/issues/63

ncoden commented 6 years ago

@HugoGiraudel

xzyfer commented 6 years ago

There's an alternative approach that would maintain BC with older Sass. You could instead have a safe-call-function. See a very simplified example below.

@function safe-call-function($name, ...$args) {
  @if function-exists('get-function') && type-of($name) == string {
    @return call(get-function($name),  ...$args);
  }
  @return call($name, ...$args);
}

This approach will work on all version Sass so theres no need for the @error.

KittyGiraudel commented 6 years ago

That’s a good idea (expect for && that should be and in Sass ;)), let’s do this. :)

ncoden commented 6 years ago

@HugoGiraudel @xzyfer I applied the required changes. See PR description

ncoden commented 6 years ago

hmmm actually I found a more suitable way to make these checks. See https://github.com/zurb/motion-ui/pull/117. I think I'll make a package from it.

ncoden commented 6 years ago

Done. See https://github.com/ncoden/sassy-functions. @HugoGiraudel @xzyfer I'll use it for this pull request, after I added some tests.