1

I need to set a variable depending on another variable passed to a mixin.

F.e.

#make-grid(@columns){
 when(@columns = 10){
  @a: 1;
 }
}

This is giving me a compile error "unrecognised input"

seven-phases-max
  • 11,765
  • 1
  • 45
  • 57
Raphael Jeger
  • 5,024
  • 13
  • 48
  • 79
  • 1
    There's no such statement as `when {...}`. `When` is either a [mixin](http://lesscss.org/features/#mixins-feature-mixin-guards-feature) or a [ruleset](http://lesscss.org/features/#mixins-feature-mixin-guards-feature) guard. Probably you mean `& when {...}` but that way the variable you define won't be visible outside of the closest brackets. In short see the duplicates of your Q: https://stackoverflow.com/questions/29496933, https://stackoverflow.com/questions/25287904, https://stackoverflow.com/questions/23738798 etc. – seven-phases-max Apr 23 '18 at 12:51
  • See also [`if` function](http://lesscss.org/functions/#misc-functions-if) in Less 3.x. – seven-phases-max Apr 23 '18 at 12:52

0 Answers0