-
-
Save vpugh/ebb101b4053214a7368f to your computer and use it in GitHub Desktop.
Prefixing with Sass
This file contains hidden or 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 border-radius($radius, $prefixes: -moz -webkit -o) { | |
| @each $prefix in $prefixes { | |
| #{$prefix}-border-radius:$radius; | |
| } | |
| border-radius:$radius; | |
| } | |
| #id { | |
| @include border-radius(5px, -moz -webkit); | |
| } | |
| // Gives you | |
| #id { | |
| -moz-border-radius: 5px; | |
| -webkit-border-radius: 5px; | |
| border-radius: 5px; | |
| } | |
| // Or make it even more generic | |
| @mixin prefix($property, $value, $prefixes) { | |
| @each $prefix in $prefixes { | |
| #{$prefix}-#{$property}:$value; | |
| } | |
| #{$property}:$value; | |
| } | |
| @mixin border-radius($radius, $prefixes: -moz -webkit -o) { | |
| @include prefix(border-radius,$radius,$prefixes); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment