Skip to content

Instantly share code, notes, and snippets.

@raybrownco
Created March 20, 2012 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raybrownco/2139592 to your computer and use it in GitHub Desktop.
Save raybrownco/2139592 to your computer and use it in GitHub Desktop.
I just stumbled across theCSSguru's animate mixin for Sass (http://thecssguru.freeiz.com/animate/) and found it very useful for including animations in my Sass files. However, I saw room for improvement in the keyframe code. Below is a comparison of the s
// Using a list to loop through each prefix and cut down on duplicated code
$keyframe-prefixes: (-webkit-keyframes, -moz-keyframes, -ms-keyframes, keyframes)
@each $prefix in $keyframe-prefixes
@#{$prefix} fadeIn
0%
opacity: 0
100%
opacity: 1
// Original keyframe code found at http://thecssguru.freeiz.com/animate/
@-webkit-keyframes fadeIn
0%
opacity: 0
100%
opacity: 1
@-moz-keyframes fadeIn
0%
opacity: 0
100%
opacity: 1
@-ms-keyframes fadeIn
0%
opacity: 0
100%
opacity: 1
@keyframes fadeIn
0%
opacity: 0
100%
opacity: 1
@theCSSguru
Copy link

Hey! Yeah it's erroring on line 5 of your new code for @#{$prefix} - it doesn't like the @...

I was doing the same thing in my tests and it wasn't having it, so trying to find a solution to this, and from what I have seen so far there isn't one just yet, hmm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment