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

Support @return in mixin #2667

Closed
rentalhost opened this issue Aug 14, 2015 · 2 comments
Closed

Support @return in mixin #2667

rentalhost opened this issue Aug 14, 2015 · 2 comments

Comments

@rentalhost
Copy link

Currently we can use a king of hack to return a value from a mixin. For instance:

.sum (@a, @b) { 
    @return: (@a + @b); 
}
.size { 
    .sum(5px, 10px); 
    width: @return; 
    .sum(15px, 15px); 
    height: @return; 
}

But it is ugly.

Suggestion is use the @return variable to literally return a value directly from mixin.

.size {
    width: .sum(5px, 10px);
    height: .sum(15px, 15px);
}

Both should return:

.size {
    width: 15px;
    height: 30px;
}

To avoid breaking changes, both examples should work. @return will keep to set the variable on scope, but too will be used as result of mixin.

@seven-phases-max
Copy link
Member

See #538 and less-plugin-functions.

@seven-phases-max
Copy link
Member

Closing as duplicate of #538.

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