I've been lurking around for a mixin that would create prefixed keyframes declarations, but i couldn't find anything that actually work as it should without ugly fixes.
So far i've managed to create the following mixin:
.keyframes(@identifier, @animation) {
.frames { content: ~"'';} @-webkit-keyframes @{identifier} {@{animation}} @-moz-keyframes @{identifier} {@{animation}} @-ms-keyframes @{identifier} {@{animation}} @-o-keyframes @{identifier} {@{animation}} @keyframes @{identifier} {@{animation}"}
}
Where the usage would be:
.keyframes(fade-in, ~"0% { opacity: 0; }50% { opacity: 0; }100% { opacity: 1; }");
I feel like this is just plain wrong in matters of readability and also it creates a rule ( .frames { content: '' };
) for each time the .keyframes()
mixin is called.
Is there another way of doing this nicely?
Sidenote:
When i type npm info less --version
it returns 1.4.28
if that's important.