I understand LESS doesn’t have if/else structure and instead relies on guarded mixin statements. It doesn’t appear to be able to set a LESS CSS variable inside of a mixin though.
Anyone have an idea of how I could implement something to the effect of.
if( ispercentage( @height ) {
@height: "1024px";
}
// Calculations dependent on @height
@textAreaHeight = 0.5 * @height;
@buttonHeight = 0.2 * @height;
I’ve looked at several other stackoverflow questions including:
LESS CSS – Setting variable within mixin
Yes, it can be done. There was one bug that needed to be worked around.
Example LESS Code
Example CSS Output