- Less Basic Tutorial
- Less - Home
- Less - Overview
- Less - Installation
- Language Features
- Less - Nested Rules
- Less - Nested Directives and Bubbling
- Less - Operations
- Less - Escaping
- Less - Functions
- Less - Namespaces and Accessors
- Less - Scope
- Less - Comments
- Less - Importing
- Less - Variables
- Less - Extend
- Less - Mixins
- Less - Parametric Mixins
- Less - Mixins as Functions
- Less - Passing Rulesets to Mixins
- Less - Import Directives
- Less - Import Options
- Less - Mixin Guards
- Less - CSS Guards
- Less - Loops
- Less - Merge
- Less - Parent Selectors
- Functions
- Less - Misc Functions
- Less - String Functions
- Less - List Functions
- Less - Math Functions
- Less - Type Functions
- Less - Color Defination Functions
- Less - Color Channel Functions
- Less - Color Operation
- Less - Color Blending Functions
- Usage
- Less - Command Line Usage
- Using Less In The Browser
- Less - Browser support
- Less - Plugins
- Less - Programmatic Usage
- Less - Online Compilers
- Less - GUIs
- Less - Editors and Plugins
- Less - Third Party Compilers
- Less - Frameworks
- Less Useful Resources
- Less - Quick Guide
- Less - Useful Resources
- Less - Discussion
LESS Advanced Arguments and @rest Variable
Description
Mixin takes variable number of arguments by using .... You can assign arguments to the variable by placing ... after the variable name.
The following program shows simple formats of using arguments −
.mixin(...) { // it matches arguments from 0-n .mixin() { // it matches exactly 0 arguments .mixin(@x: 1) { // it matches arguments from 0-1 .mixin(@x: 1; ...) { // it matches arguments from 0-n .mixin(@x; ...) {
You can use the @rest variable in the code as −
.mixin(@x; @rest...) { // after the variable @a, the @rest is bound to arguments // @arguments is bound to all arguments }
less_parametric_mixins.htm
Advertisements