Created
September 13, 2016 05:54
-
-
Save kaelig/2425f02e3d41ef3a892a4df853a94894 to your computer and use it in GitHub Desktop.
Safe get-function in Sass 3.3.x and up
This file contains 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
// Simplified version of safe-get-function | |
// Full code: https://github.com/kaelig/sass-safe-get-function | |
@function safe-get-function($name) { | |
@if function-exists('get-function') { | |
@return get-function($name); | |
} @else { | |
@return $name; | |
} | |
} | |
@function foo($x) { @return $x; } | |
h1 { | |
content: call(safe-get-function('foo'), 'Works in all versions of Sass!'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment