Arrays with Less

The answer to the question is “Yes, you can create and work with arrays in Less”. An array (in CSS and thus Less realm it’s usually referred to as “List”) is defined with just the same code as in your Q: @badge-colors: blue #7FB3D4, gray #767676, green #8CC079, red #b35d5d; See “List Functions” for functions … Read more

How to use if statements in LESS

There is a way to use guards for individual (or multiple) attributes. @debug: true; header { /* guard for attribute */ & when (@debug = true) { background-color: yellow; } /* guard for nested class */ #title when (@debug = true) { background-color: orange; } } /* guard for class */ article when (@debug = … Read more

Loop over an array of name value pairs in LESS

The answer given by @seven-phases-max works very well. For completeness you should also notice that you can do the same in Less without the imported “for” snippet. from In trying to stay as close as possible to the declarative nature of CSS, Less has opted to implement conditional execution via guarded mixins instead of … Read more