I'm relatively new to LESS
and I'm trying to figure out a way to have simple code for activating and deactivating OpenType features. I understand what a variable and a parametric mixin is but am not sure how to put them together, if possible.
Other suggestions on how to solve this problem would be greatly appreciated.
/*Variables for enabling and disabling feature*/
@on: 1;
@off: 0;
/*Turn on feature*/
.liga (@on){
-moz-font-feature-settings:"liga" 1;
-ms-font-feature-settings:"liga" 1;
-o-font-feature-settings:"liga" 1;
-webkit-font-feature-settings:"liga" 1;
font-feature-settings:"liga" 1;
}
/*Turn off feature*/
.liga (@off){
-moz-font-feature-settings:"liga" 0;
-ms-font-feature-settings:"liga" 0;
-o-font-feature-settings:"liga" 0;
-webkit-font-feature-settings:"liga" 0;
font-feature-settings:"liga" 0;
}
/*Sample use*/
p{
.liga(@on);
}
You can use the
when
conditions in less like this:or you can try to create a unique function and pass value inside it like this: