Last active
August 29, 2015 14:01
-
-
Save peteeveleigh/6d88a88b872cc4184682 to your computer and use it in GitHub Desktop.
Sass/SCSS Mixin to create vendor prefixes on any property:value pair
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
/* | |
Mixin to add vendor prefixes to any property:value | |
By default prefixes for -moz and -webkit will be created | |
By specifying a list as the third parameter a custom list of prefixes can be made | |
e.g. | |
.cheese { | |
@include prefix($foo,$bar,(moz,webkit,o,ms)); | |
} | |
will produce | |
.cheese { | |
-moz-foo: bar; | |
-webkit-foo: bar; | |
-o-foo: bar; | |
-ms-foo: bar; | |
foo: bar; } | |
*/ | |
@mixin prefix($property, $value, $prefixes:(moz,webkit)) { | |
@each $prefix in $prefixes { | |
-#{$prefix}-#{$property}: $value; | |
} | |
#{$property}:$value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment