I'm using LESS to build a site, and want the layout to switch based on direction, either 'ltr' or 'rtl' (direction:rtl)
I set @direction at the top. Then there are certain elements that I want floated left for ltr, and right for rtl. I also want to position absolute, and apply padding-left/right based on the @direction.
Instead of writing out separate mixins for float, pos, and padding I was trying to do something like this:
.mixin (@direction) when (@direction = ltr) {
@lr:left;
}
.mixin (@direction) when (@direction = rtl) {
@lr:right;
}
Then call it like this:
ol li {
float:@lr;
}
and/or
ol li span.date {
position:absolute;
@lr:0;
}
That's the idea, but any help would be appreciated. I've looked at guards, and parametric mixins but just can't seem to nail it.
Thanks, Dave