Mixin return values
See original GitHub issueCan I set a return value as a color? As in:
.myselector {
border: 1px solid .custommixin(@colorValue);
}
Just wondering in response to another user’s issue regarding color functions: https://github.com/cloudhead/less.js/pull/488
Issue Analytics
- State:
- Created 12 years ago
- Reactions:13
- Comments:59 (41 by maintainers)
Top Results From Across the Web
mixin and @include - Sass
keywords() function takes an argument list and returns any extra keywords that were passed to the mixin as a map from argument names...
Read more >LESS - Mixin & return values - Tutorialspoint
LESS - Mixin & return values, Mixins are similar to functions and the variables that are defined in a mixin will behave as...
Read more >Sass/scss 'mixin as a function' to return a string with parameters?
I have a Mixin in LESS with parameters that returns a string. I use this mixin calculate responsive properties like margins, paddings and ......
Read more >How do I change the return value using a Mixin?
I have a method that i want to change that looks like this: public boolean checkSomething(int value) { return (value / other value) ......
Read more >Sass/SCSS Mixins, Functions & @includes Tutorial - KoderHQ
To return a value from a function, we use the @return rule, followed by the value we want to return. Syntax: SCSS function....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@distransient There has been more in-depth discussion around designing solutions for this in: https://github.com/less/less-meta/issues/16.
(Less-meta is a repo for higher-level goal planning for Less.js, rather than individual issues or bug reports.)
The problem is that there’s no way to forbid using mixins as functions. It is possible to use one as the other and they (and me 😃 get to use that ability. So de facto it’s only a matter of syntactic sugar and verbosity:
Using same “function” twice in the “same scope”:
Is there a reason to invent some new “Less function declaration/definition” syntax (different from a mixin definition syntax) only to not allow to use
width: .sum(20px, 33px);
directly?