madskristensen / WebEssentials2012

http://vswebessentials.com
Other
95 stars 46 forks source link

LESS Compile Error with Animation Keyframe Mixin #81

Open someyoungideas opened 9 years ago

someyoungideas commented 9 years ago

So I recently found a great way to create mixin for animations using LESS and attempted in WE 2012. I was unable to get the file to compile unfortunately. It seems to be having issues with the @arguments being passed into the .keyframes. Allowing variables with @keyframes was allowed in LESS starting v1.7.0, https://github.com/less/less.js/blob/master/CHANGELOG.md. Here is my code

.whywouldyoudothis {
    .keyframes(blink;
        {
            0% { background: #fff; }
            100% { background: #000; }
        });

    .animation(blink 1s ease inifinite alternate);
}

.keyframes(@name; @arguments) {
    @-moz-keyframes @name { @arguments(); }
    @-webkit-keyframes @name { @arguments(); }
    @-o-keyframes @name { @arguments(); }
    @keyframes @name { @arguments(); }
}

.animation(@arguments) {
    -webkit-animation: @arguments;
    -moz-animation: @arguments;
    animation: @arguments;
}

And here is the compile error LESS: Unrecognised input