Created
April 24, 2014 22:45
-
-
Save nicooprat/11272098 to your computer and use it in GitHub Desktop.
Vendor prefix mixin for LESS
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
/* It should output something like this... Easy ! */ | |
.test { | |
animation: pulse 0.5s 1 both; | |
-ms-animation: pulse 0.5s 1 both; | |
-moz-animation: pulse 0.5s 1 both; | |
-webkit-animation: pulse 0.5s 1 both; | |
-o-animation: pulse 0.5s 1 both; | |
transition: all 0.25s; | |
-ms-transition: all 0.25s; | |
-moz-transition: all 0.25s; | |
-webkit-transition: all 0.25s; | |
-o-transition: all 0.25s; | |
transform: scale(1.5); | |
-ms-transform: scale(1.5); | |
-moz-transform: scale(1.5); | |
-webkit-transform: scale(1.5); | |
-o-transform: scale(1.5); | |
} |
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
// -------------- | |
// Needs LESS compiler >= 1.6.0 | |
// Docs : http://lesscss.org/features/#variables-feature-properties | |
// -------------- | |
// 1. Define the mixin | |
.vendor-prefix(@prop,@val) { | |
@{prop}: @val; | |
-ms-@{prop}: @val; | |
-moz-@{prop}: @val; | |
-webkit-@{prop}: @val; | |
-o-@{prop}: @val; | |
} | |
// 2. Use it | |
.test { | |
.vendor-prefix( animation, pulse .5s 1 both ); | |
.vendor-prefix( transition, all .25s ); | |
.vendor-prefix( transform, scale(1.5) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment