LESS - Mixins as Functions



In this chapter, we will understand the importance of Mixins as Functions. Like functions, mixins can be nested, can accept parameters, and return values too.

The following table demonstrates the use of mixins as functions in details.

Sr.No. Mixins usage & Description
1 Mixin scope

Mixins consist of variables; these can be used in caller's scope and are visible.

2 Mixin and return values

Mixins are similar to functions and the variables that are defined in a mixin will behave as the return values.

3 Mixin inside another mixin

Whenever a mixin is defined inside another mixin, it can be used as return value too.

Advertisements