Book Image

LESS WEB DEVELOPMENT COOKBOOK

Book Image

LESS WEB DEVELOPMENT COOKBOOK

Overview of this book

Table of Contents (19 chapters)
Less Web Development Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using mixins with multiple parameters


As also seen in the Setting the properties of CSS styles with mixins recipe in Chapter 1, Getting to Grips with the Basics of Less and the Using parametric mixins recipe in Chapter 3, Using Variables and Mixins, mixins can take arguments, which are variables passed to the block of selectors when it is mixed in. The mixin in the recipe in Chapter 1, Getting to Grips with the Basics of Less, accepts a single parameter as argument only, but mixins can be built to accept more than one parameter. In this section, you will learn how to use mixins with more than one parameter.

Getting ready

For this recipe, you will have to create a Less file, for instance, mixins.less. You can compile this mixins.less file with the command-line lessc compiler, as described in the Installing the lessc compiler with npm recipe in Chapter 1, Getting to Grips with the Basics of Less.

How to do it…

  1. Create the mixins.less file and write down the following Less code into it:

    .mixin(@color...