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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.