Reputation: 9701
I just started on LESS because of it's flexibility, and I ran into a problem. I want to do something like this:
.shadow-argument ( @type, @horizontal, @vertical, @blur, @color ) when ( @type = normal ) {
@argument = @horizontal @vertical @blur @color;
}
.shadow-argument ( @type, @horizontal, @vertical, @blur, @color ) when ( @type = inset ) {
@argument = @horizontal @vertical @blur @color inset;
}
And then pass the function to an argument like this:
@shadow-something: .shadow-argument(normal, 1px, 1px, 3px, #eeeeee);
Is it possible ? If not what would be the way around it ?
Upvotes: 0
Views: 60
Reputation: 96934
Just put it in place of the argument and it will match the correct one:
.shadow-argument(normal, @horizontal, @vertical, @blur, @color) {
@argument = @horizontal @vertical @blur @color;
}
.shadow-argument(inset, @horizontal, @vertical, @blur, @color) {
@argument = @horizontal @vertical @blur @color inset;
}
Upvotes: 1