Permalink
Browse files

Added keyframes mixin that prevents redundant prefixes in its contents

  • Loading branch information...
1 parent 60cf83c commit bb654222b8ecce729ceb25afd264b6c36f6cf992 @bmorrall bmorrall committed with Phil LaPier Dec 22, 2012
Showing with 41 additions and 0 deletions.
  1. +1 −0 app/assets/stylesheets/_bourbon.scss
  2. +40 −0 app/assets/stylesheets/css3/_keyframes.scss
@@ -25,6 +25,7 @@
@import "css3/hidpi-media-query";
@import "css3/image-rendering";
@import "css3/inline-block";
+@import "css3/keyframes";
@import "css3/linear-gradient";
@import "css3/perspective";
@import "css3/radial-gradient";
@@ -0,0 +1,40 @@
+// Adds keyframes blocks for supported prefixes, removing redundant prefixes in the block's content
+@mixin keyframes($name) {
+ $original-prefixer-enabled-for-mozilla: $prefixer-enabled-for-mozilla;
+ $original-prefixer-enabled-for-webkit: $prefixer-enabled-for-webkit;
+ $original-prefixer-enabled-for-opera: $prefixer-enabled-for-opera;
+ $original-prefixer-enabled-for-microsoft: $prefixer-enabled-for-microsoft;
+ $original-prefixer-enabled-for-spec: $prefixer-enabled-for-spec;
+
+ @if $original-prefixer-enabled-for-mozilla {
+ @include prefixer-disable-all();
+ $prefixer-enabled-for-mozilla: true;
+ @-moz-keyframes #{$name} { @content; }
+ }
+ @if $original-prefixer-enabled-for-webkit {
+ @include prefixer-disable-all();
+ $prefixer-enabled-for-webkit: true;
+ @-webkit-keyframes #{$name} { @content; }
+ }
+ @if $original-prefixer-enabled-for-opera {
+ @include prefixer-disable-all();
+ $prefixer-enabled-for-opera: true;
+ @-o-keyframes #{$name} { @content; }
+ }
+ @if $original-prefixer-enabled-for-microsoft {
+ @include prefixer-disable-all();
+ $prefixer-enabled-for-microsoft: true;
+ @-ms-keyframes #{$name} { @content; }
+ }
+ @if $original-prefixer-enabled-for-spec {
+ @include prefixer-disable-all();
+ $prefixer-enabled-for-spec: true;
+ @keyframes #{$name} { @content; }
+ }
+
+ $prefixer-enabled-for-mozilla: $original-prefixer-enabled-for-mozilla;
+ $prefixer-enabled-for-webkit: $original-prefixer-enabled-for-webkit;
+ $prefixer-enabled-for-opera: $original-prefixer-enabled-for-opera;
+ $prefixer-enabled-for-microsoft: $original-prefixer-enabled-for-microsoft;
+ $prefixer-enabled-for-spec: $original-prefixer-enabled-for-spec;
+}

0 comments on commit bb65422

Please sign in to comment.