People who are used to functional programming expect a mixin to change or return a value. In this recipe, you will learn to use mixins as a function that returns a value.
In this recipe, the value of the width property inside the div.small
and div.big
selectors will be set to the length of the longest side of a right-angled triangle based on the length of the two shortest sides of this triangle using the Pythagoras theorem.
The best and easiest way to inspect the results of this recipe will be compiling the Less code with the command-line lessc
compiler, as described in the Installing the lessc compiler with npm in Chapter 1, Getting to Grips with the Basics of Less. You can edit the Less code with your favorite editor.