$_vendor-prefixes: compact(-moz -webkit -o -ms); $_common-prefixes: compact(-moz -webkit -o); // Outputs vendor prefixed property names @mixin with-vendor-prefix($property, $values, $type: default){ $prefixes:if($type == default, $_vendor-prefixes, $_common-prefixes); @each $prefix in $prefixes{ #{join(compact($prefix), compact($property), ",")}:$values; } } @mixin background-size($size1: 100% auto, $size2: false, $size3: false, $size4: false, $size5: false){ $sizes: compact($size1, $size2, $size3, $size4, $size5); @include with-vendor-prefix(background-size, $sizes, common); background-size:$sizes; } @mixin border-radius($radius){ @include with-vendor-prefix(border-radius, $radius); border-radius:$radius; } @mixin box-shadow($color, $horiz, $vert, $blur, $spread, $inner){ $props: compact(); @if( $inset == true or $inset == inset ){ $props: join($props, inset); } $props: join($props, compact($color $horiz $vert $blur $spread)); @include with-vendor-prefix(box-shadow, spacify($props)); box-shadow: spacify($props); } @mixin linear-gradient($pos, $g1, $g2:false, $g3:false, $g4:false, $g5:false, $g6:false, $g7:false, $g8:false, $g9:false, $g10:false){ $pos-type: type-of(nth($pos, 1)); @if ($pos-type == color) or (nth($pos, 1) == "transparent"){ $g10: $g9; $g9: $g8; $g8: $g7; $g7: $g6; $g6: $g5; $g5: $g4; $g4: $g3; $g3: $g2; $g2: $g1; $g1: $pos; $pos: top; // Default position } $basic: ($g1); $webkit: color-stop($g1); @each $grad in $g2 $g3 $g4 $g5 $g6 $g7 $g8 $g9 $g10{ @if $grad != false{ $basic: $basic + ',' + $grad; $webkit: $webkit + ',' + color-stop($grad); } } $basic: unquote($basic); $webkit: unquote($webkit); background-color: nth($g1, 1); background: deprecated-webkit-gradient(linear, $basic) no-repeat; background: -webkit-gradient(linear, $pos, $webkit) no-repeat; background: -webkit-linear-gradient($pos, $basic) no-repeat; background: -moz-linear-gradient($pos, $basic) no-repeat; background: -ms-linear-gradient($pos, $basic) no-repeat; background: -o-linear-gradient($pos, $basic) no-repeat; background: linear-gradient($pos, $basic) no-repeat; } @mixin transition($properties:all, $duration: 1s, $delay:false, $function: false){ @include transition-property($properties); @include transition-duration($duration); @include transition-timing-function($function); @include transition-delay($delay); } @mixin transition-property($properties: all) { @include with-vendor-prefix(transition-duration, unquote($properties)); transition-property:spacify($properties); } @mixin transition-duration($duration: 1s) { @include with-vendor-prefix(transition-duration, if(type-of($duration) == string, unquote($duration), $duration)); transition-duration:$duration; } @mixin transition-timing-function($function: false) { @include with-vendor-prefix(transition-timing-function, unquote($function)); transition-timing-function:$function; } @mixin transition-delay($delay: false) { @include with-vendor-prefix(transition-delay, if(type-of($delay) == string, unquote($delay), $delay)); transition-delay:$delay; }