Less css with advanced options

This may be a quick and easy question, but I still could not find the answer.

Less is there any way to use mixin (say .mixin(@a: 2, @b: 3) { /* css here */ } ) and only supply values ​​for the given parameters? I know I can use this as .mixin(5) , which will be the same as .mixin(5, 3) , but can I do something like .mixin(@b: 5) ? The value is the same as .mixin(2, 5) (however, I did not need to know the value of a to use by default).

+6
source share
1 answer

In less use of the targetless compiler you can do

.mixin (@b: 3);

This will be in the original less.js in 1.3.1 (next release) - see https://github.com/cloudhead/less.js/pull/268

+13
source

Source: https://habr.com/ru/post/917113/


All Articles