Last active
August 29, 2015 14:06
-
-
Save KittyGiraudel/7defdda692bfd2f2e6a9 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
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
| // ---- | |
| // Sass (v3.4.13) | |
| // Compass (v1.0.3) | |
| // ---- | |
| // Global map hosting function aliases | |
| // @type Map | |
| // @prop {String} key - Alias name | |
| // @prop {String} value - Mapped function | |
| $function-aliases: () !global; | |
| // Mixin to add aliases to alias map | |
| // @param {String} $function - Function to alias | |
| // @param {List} $aliases - List of aliases to add | |
| // @requires $function-aliases | |
| // @output Nothing | |
| @mixin add-alias($function, $aliases...) { | |
| @each $alias in $aliases { | |
| $function-aliases: map-merge($function-aliases, ($alias: $function)) !global; | |
| } | |
| } | |
| // Add aliases to the `round` function to work around typos | |
| @include add-alias('round', 'roudn', 'ruond'); | |
| // Proxy function | |
| // @param {String} $function - Function to call | |
| // @param {Arglist} $arguments - Arguments to pass to `$function` | |
| // @requires $function-aliases | |
| // @return Result of `$function` with `$arguments` | |
| @function proxy($function, $arguments...) { | |
| @if map-has-key($function-aliases, $function) { | |
| @return call(map-get($function-aliases, $function), $arguments...); | |
| } | |
| @return call($function, $arguments...); | |
| } | |
| sass { | |
| test: proxy('roudn', 13.37); | |
| } | |
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
| sass { | |
| test: 13; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment