Last active
May 10, 2023 19:13
-
-
Save krypton225/12a5bd7b74ba66756b374a29f429995e to your computer and use it in GitHub Desktop.
Useful functions in SCSS.
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
| @function get-half($number) { | |
| @return $number / 2; | |
| } | |
| @function square($number) { | |
| @return $number * $number; | |
| } | |
| @function rem($px-val) { | |
| $rem-val: $px-val / $base-fz; | |
| $safe-rem-value: if($px-val == 0, 0, $rem-val); | |
| @return $zero-safe-rem-value; | |
| } | |
| /* | |
| * This code belongs to: Kitty Giraudel. | |
| * You can see that in: https://css-tricks.com/snippets/sass/strip-unit-function/ | |
| * We updated the using of math lib of sass. | |
| */ | |
| @function strip-unit($num) { | |
| @if type-of($num) == "number" and not unitless($num) { | |
| @return math.div($num, ($num * 0 + 1)); | |
| } | |
| @return $num; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment