Developing parametric mixins

So far, we have examined how you can use mixins to create blocks of code that can easily be reused throughout your style sheets. On principle, this works great. However, what if you found yourself wanting to reuse the same block of code but couldn't, as the values were different?

Well, this is possible with Less; we've already covered how we can create mixins as reusable blocks of code. Let's take this a step further and introduce the use of parameters—here, we can pass values between the main Less file and individual mixins. When compiled, Less will use the appropriate values that are being passed to produce the desired CSS. Let's see this in action by making some changes to our simple form, which we created earlier ...

Get Learning Less.js now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.