V
V
Vladimir2016-11-07 02:26:43
css
Vladimir, 2016-11-07 02:26:43

Why doesn't mixin work in less without parameters?

Compiled an ingenious mixin following the example stackoverflow.com/questions/23518694/using-less-mi...
In the example, the number of parameters cannot be less than 1, but mine can.
But the modified version in the case when the parameters are 0 simply does not work
.

.transition(@value) {
    transition+: @property .5s @timing;
    @n: length(@value);
    .-(); .-() {
        @property: extract(@value, 1);
        @timing:   extract(@value, 2);
    }
    .-() when (@n < 1) {@property: all}
    .-() when (@n < 2) {@timing: cubic-bezier(.68, -.55, .265, 1.55)}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Bobylev, 2016-11-07
@dpigo

You need to set a default value if you plan to use the mixin with or without parameters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question