嵌套时 mixin 括号是可选的吗?

Are mixin parenthesis optional when nested?

考虑以下几点:

.flashing {

    .flashKeyFrames(fade-in;{
        0%, 100% {opacity: 1;}
        50% {opacity: 0;}
        });

    .flashing(fade-in linear infinite alternate; 1s)

}

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

.flashing(@arguments, @duration) {
    -webkit-animation: @arguments;
    -moz-animation: @arguments;
    animation: @arguments;

    -webkit-animation-duration: @duration;
    -moz-animation-duration: @duration;
    animation-duration: @duration;
}

@arguments后面的括号是什么?我认为括号在用作混合时是可选的?所以我假设 @arguments 没有被定义为 mixin,那么它是什么?

不,.flashKeyFrames 中使用的 @arguments 不是 mixin。它 是传递给混入的参数。设置为此参数的值集是 detached ruleset 并且要使分离的规则集调用起作用,末尾的括号 () 是必需的。以下是 Less 网站的摘录:

Parentheses after a detached ruleset call are mandatory. The call @detached-ruleset; would NOT work.

仅当调用混合而非规则集时,括号才不是可选的。