Replies: 1 comment
-
To achieve setting properties and returning a value from a mixin in a single call, you can use the unnamed lookups feature in Less. This allows you to call a mixin and look up its final value without preventing the output of properties. Here's how you can modify your mixin and use it: .test-fn(@param1, @param2, @param3, @param4, @param5) {
prop1: (@param1 + @param2 + @param3 + @param4 + @param5);
@return: (@param1 * 2 + @param2 * 2 + @param3 * 2 + @param4 * 2 + @param5 * 2);
}
div {
.test-fn(7, 35, 8, 4, 20); // This will output prop1
prop2: .test-fn(7, 35, 8, 4, 20)[]; // This will output prop2
} Using To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to set properties and return a value from a mixin just in one call. For instance, for the following mixin:
I should make two calls:
to have both
prop1
andprop2
defined. Is there a compiling mode, when using a result ([]
) doesn't prevent outputting properties? I suppose, it's so intuitive.Beta Was this translation helpful? Give feedback.
All reactions