Last active
October 29, 2020 06:48
-
-
Save dbox/56b31bee89fff85fd0d9ae1054884de6 to your computer and use it in GitHub Desktop.
postcss mixin
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
/* some pre-defined custom properties in my code */ | |
:root { | |
--default-transition-duration: .2s; | |
--default-easing: ease-out; | |
} | |
/* define mixin */ | |
@define mixin transition(--transition-property: all, --transition-duration: var(--default-transition-duration), --easing: var(--default-easing) ) { | |
transition: --transition-property --transition-duration --easing; | |
} | |
/*input */ | |
.my-thing { | |
@mixin transition(); | |
padding: 2%; | |
} | |
/*output */ | |
.my-thing { | |
transition: all .2s ease-out; | |
padding: 2%; | |
} | |
/*input */ | |
.my-other-thing { | |
@mixin transition(--transition-property: border); | |
} | |
/* output */ | |
.my-other-thing { | |
transition: border .2s ease-out; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment