Skip to content

Instantly share code, notes, and snippets.

@davidicus
Last active August 29, 2015 14:18
Show Gist options
  • Save davidicus/33f37c0765c705f3cd0c to your computer and use it in GitHub Desktop.
Save davidicus/33f37c0765c705f3cd0c to your computer and use it in GitHub Desktop.
create unique names for keyframes with unique-id()
.some-element {
animation: 10s linear infinite;
animation-name: uevk2bess;
}
@keyframes uevk2bess {
from {
background-position: 0% 0%;
}
to {
background-position: 114.2857% 0%;
}
}
// ----
// 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