I'm trying to generate margin classes in Less. I've the code:
.generate-margin(5);
.generate-margin(@n, @i: 1) when (@i =< @n) {
.mb-@{i} {
margin-bottom: (@i * 5px) !important;
}
.generate-margin(@n, (@i + 1));
}
Which Outputs:
.mb-1 {
margin-bottom: 5px !important;
}
.mb-2 {
margin-bottom: 10px !important;
}
.mb-3 {
margin-bottom: 15px !important;
}
.mb-4 {
margin-bottom: 20px !important;
}
.mb-5 {
margin-bottom: 25px !important;
}
But instead of .mb-1, .mb-2, .mb-3, .mb-4, .mb-5 I want .mb-5, .mb-10, .mb-15, .mb-20, .mb-25. How to do that.