Skip to content

How to prefix keyframes #1264

@jimisaacs

Description

@jimisaacs

I see a lot of issues about having support for @Keyframes, but I wanted to figure something out.

How in the world can I use LESS to simplify having to put multiple keyframe blocks for each browser "@-moz-keyframe", "@-webkit-keyframes", etc.? Is it possible, or even worth trying?

I've looked all over, and tried myself. I see some pretty complicated, and unusable solutions in my case. Basically I am wondering if we are required to copy and paste keyframes and prefix them, am I winning anything by using LESS for this type of CSS? The types of things I (and many other devs) build now days have many and many different kinds of animations per project.

I'm am at a loss here. Even if it is actually possible to use some sort of complicated mixin, still using a nested prefixed mixin inside a keyframe is kind of pointless, it would output something like:

@keyframes myAni {
    100% { 
        -webkit-transform: translate(100px, 0);
        -moz-transform: translate(100px, 0);
        transform: translate(100px, 0);
    }
}
@-webkit-keyframes myAni {
    100% { 
        -webkit-transform: translate(100px, 0);
        -moz-transform: translate(100px, 0);
        transform: translate(100px, 0);
    }
}
@-moz-keyframes myAni {
    100% { 
        -webkit-transform: translate(100px, 0);
        -moz-transform: translate(100px, 0);
        transform: translate(100px, 0);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions