Created
March 11, 2017 15:37
-
-
Save bezenson/116226f21dfe20d172a97c41b581c479 to your computer and use it in GitHub Desktop.
Shorten transition declaration via SASS (SCSS) function
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
// Default variables | |
$transition-duration: .2s; | |
$transition-timing-function: ease; | |
@function transition($arguments...) { | |
$result: null; | |
@each $prop in $arguments { | |
$result: $result, $prop $transition-duration $transition-timing-function; | |
} | |
@return $result; | |
} | |
// Usage example | |
.example { | |
transition: transition(background, color); | |
} | |
// Result: | |
.example { | |
transition: background .2s ease, color .2s ease; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment