//************************************************************************// // Example: @include prefixer(border-radius, $radii, webkit ms spec); //************************************************************************// $prefix-for-webkit: true !default; $prefix-for-mozilla: true !default; $prefix-for-microsoft: true !default; $prefix-for-opera: true !default; $prefix-for-spec: true !default; // required for keyframe mixin @mixin prefixer ($property, $value, $prefixes) { @each $prefix in $prefixes { @if $prefix == webkit and $prefix-for-webkit == true { -webkit-#{$property}: $value; } @else if $prefix == moz and $prefix-for-mozilla == true { -moz-#{$property}: $value; } @else if $prefix == ms and $prefix-for-microsoft == true { -ms-#{$property}: $value; } @else if $prefix == o and $prefix-for-opera == true { -o-#{$property}: $value; } @else if $prefix == spec and $prefix-for-spec == true { #{$property}: $value; } @else { @warn "Unrecognized prefix: #{$prefix}"; } } } @mixin disable-prefix-for-all() { $prefix-for-webkit: false; $prefix-for-mozilla: false; $prefix-for-microsoft: false; $prefix-for-opera: false; $prefix-for-spec: false; } @mixin opentype ($features:'"liga", "dlig"') { -moz-font-feature-settings: $features; -ms-font-feature-settings: $features; -o-font-feature-settings: $features; -webkit-font-feature-settings: $features; font-feature-settings: $features; } @mixin border-radius ($radius) { -webkit-border-radius: $radius; -moz-border-radius: $radius; border-radius: $radius; } // Adds keyframes blocks for supported prefixes, removing redundant prefixes in the block's content @mixin keyframes($name) { $original-prefix-for-webkit: $prefix-for-webkit; $original-prefix-for-mozilla: $prefix-for-mozilla; $original-prefix-for-microsoft: $prefix-for-microsoft; $original-prefix-for-opera: $prefix-for-opera; $original-prefix-for-spec: $prefix-for-spec; @if $original-prefix-for-webkit { @include disable-prefix-for-all(); $prefix-for-webkit: true; @-webkit-keyframes #{$name} { @content; } } @if $original-prefix-for-mozilla { @include disable-prefix-for-all(); $prefix-for-mozilla: true; @-moz-keyframes #{$name} { @content; } } @if $original-prefix-for-microsoft { @include disable-prefix-for-all(); $prefix-for-microsoft: true; @-ms-keyframes #{$name} { @content; } } @if $original-prefix-for-opera { @include disable-prefix-for-all(); $prefix-for-opera: true; @-o-keyframes #{$name} { @content; } } @if $original-prefix-for-spec { $prefix-for-spec: true !default; @include disable-prefix-for-all(); $prefix-for-spec: true; @keyframes #{$name} { @content; } } $prefix-for-webkit: $original-prefix-for-webkit; $prefix-for-mozilla: $original-prefix-for-mozilla; $prefix-for-microsoft: $original-prefix-for-microsoft; $prefix-for-opera: $original-prefix-for-opera; $prefix-for-spec: $original-prefix-for-spec; } // These mixins support the in-progress dynamic grid. How these collapse automatically as column narrows still needs to be added/defined. @mixin width($colCount: 2, $colSpan: 1, $gutter: 4%) { @if $gutter == 'auto' { width: $colSpan * (100% / $colCount); margin-left: auto; margin-right: auto; clear: both; } @else { width: $colSpan * ((100% - ($gutter * ($colCount - 1))) / $colCount); margin-left: 0; margin-right: $gutter; float: left; &:nth-of-type(#{$colCount}n + #{$colCount}) { margin-right: 0; } &:nth-of-type(#{$colCount}n + 1) { clear: left; } } } @mixin grid-columns($colCount: 2, $colSpan: 1, $gutter: 4%) { @include width($colCount, $colSpan, $gutter); @content; }