Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple mixin "return values" in the same scope #3052

Closed
kbdsbx opened this issue Apr 20, 2017 · 2 comments
Closed

Multiple mixin "return values" in the same scope #3052

kbdsbx opened this issue Apr 20, 2017 · 2 comments

Comments

@kbdsbx
Copy link

kbdsbx commented Apr 20, 2017

.test( @a, @b ) {
    @x : @a;
    @y : @b;
}

.test2 {
    .test( 15px, 20px );
    margin: @x @y;

    .test( 20px, 25px );
    margin: @x @y;
}

It must be:

.test2 {
    margin: 20px 25px;
}

but now it is:

.test2 {
    margin: 15px 20px;
}
@seven-phases-max
Copy link
Member

It must be:

No, the result is actually expected since variables in Less are lazy-evaluated and overridable
(it's actually quite important aspect of the language to understand, for more details see:

For a simple workaround of your example see #538 (comment).
For real functions use less-plugin-functions (so far at least).


Btw., it's also important to realize that mixins and functions are different things. Mixins are not functions, they can be used as such to a certain degree, but still different beasts, so in general one is better to avoid using these words as synonyms as this will be quite misdirecting and confusing (for himself primarily).

@seven-phases-max
Copy link
Member

Closing as expected behaviour (#538, less/less-meta#16).

@seven-phases-max seven-phases-max changed the title when recalled function, the return values is can't be cover. Multiple mixin "return values" in the same scope Apr 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants