Skip to content

Instantly share code, notes, and snippets.

@kaelig
Created September 13, 2016 05:54
Show Gist options
  • Save kaelig/2425f02e3d41ef3a892a4df853a94894 to your computer and use it in GitHub Desktop.
Save kaelig/2425f02e3d41ef3a892a4df853a94894 to your computer and use it in GitHub Desktop.
Safe get-function in Sass 3.3.x and up
// 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