fix: fix libsass 4 call deprecation warning #63#65
Open
ncoden wants to merge 4 commits intoat-import:masterfrom
Open
fix: fix libsass 4 call deprecation warning #63#65ncoden wants to merge 4 commits intoat-import:masterfrom
ncoden wants to merge 4 commits intoat-import:masterfrom
Conversation
Contributor
Author
KittyGiraudel
approved these changes
Jun 1, 2018
| /// | ||
| /// @return {Function|String} | ||
| /// | ||
| @function safe-get-function($name) { |
Contributor
There was a problem hiding this comment.
Shall this be prefixed with sl-?
|
There's an alternative approach that would maintain BC with older Sass. You could instead have a @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 |
Contributor
|
That’s a good idea (expect for |
Use `sl-safe-call-function` instead and add a warning message to encourage users to switch to first-class functions.
sl-safe-call-function($func, ...$args)
Polyfill for the `call` function supporting both functions and strings.
Contributor
Author
|
@hugogiraudel @xzyfer I applied the required changes. See PR description |
Contributor
Author
|
hmmm actually I found a more suitable way to make these checks. See foundation/motion-ui#117. I think I'll make a package from it. |
Contributor
Author
|
Done. See https://github.com/ncoden/sassy-functions. @hugogiraudel @xzyfer I'll use it for this pull request, after I added some tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix the following deprecation warning:
Call
call()with a function retrieved by the new functionget-function.Changes:
sl-safe-call-functionpolyfill forcall()with support of both function (LibSass >= 3.5) and function name string (LibSass < 3.5)sl-safe-call-functioninstead ofcall()Closes #63