After observing that a section of Less that I believed was functioning correctly is not producing all the styles I require, I realized that my for loop is not functioning properly.
The specific less code snippet in question is:
.for(@list, @code) {
& {
.loop(@i:1) when (@i =< length(@list)) {
@value: extract(@list, @i);
@code();
.loop(@i + 1);
}
.loop();
}
}
.role-variants(@variants, @props){
.for(@variants, {
.security_class_@{value} {
@props();
}
});
}
@admin-roles: admin, admin_manager, admin_user, admin_manager_user;
html{
body{
&.admin{
.role-variants(@admin-roles, {display: block;});
}
}
}
On , this code compiles correctly, generating the anticipated classes.
However, when compiling locally, only the following class is generated:
html body.admin .security_class_admin {
display: block
}
Although the for loop functions properly when using the less compiler on the website, it fails to work locally. I am unsure whether I need to adjust the code for local compilation or update my environment to a specific version, despite it being current.
Thank you for your assistance.
- Jamie