Last active
August 29, 2015 14:18
-
-
Save davidicus/33f37c0765c705f3cd0c to your computer and use it in GitHub Desktop.
create unique names for keyframes with unique-id()
This file contains 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
.some-element { | |
animation: 10s linear infinite; | |
animation-name: uevk2bess; | |
} | |
@keyframes uevk2bess { | |
from { | |
background-position: 0% 0%; | |
} | |
to { | |
background-position: 114.2857% 0%; | |
} | |
} |
This file contains 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
// ---- | |
// Sass (v3.4.12) | |
// Compass (v1.0.3) | |
// ---- | |
@mixin animation-keyframes { | |
$animation-name: unique-id(); | |
animation-name: $animation-name; | |
@keyframes #{$animation-name} { | |
@content; | |
} | |
} | |
.some-element { | |
animation: 10s linear infinite; | |
@include animation-keyframes { | |
from { | |
background-position: 0% 0%; | |
} | |
to { | |
background-position: 114.2857% 0%; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment