-
-
Save fortes/1160840 to your computer and use it in GitHub Desktop.
Sassy exponents
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
// Sass exponent support | |
@function exponent($base, $exponent) | |
// reset value | |
$value: $base | |
// positive intergers get multiplied | |
@if $exponent > 1 | |
@for $i from 2 through $exponent | |
$value: $value * $base | |
// negitive intergers get divided. A number divided by itself is 1 | |
@if $exponent < 1 | |
@for $i from 0 through -$exponent | |
$value: $value / $base | |
// return the last value written | |
@return ($value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment