less - Change unit in a mixin -


let's have less mixin changes unit vw.

.change-unit (@property, @value) {   @{property}: unit(@value, vw); } 

then calling .change-unit(width, 10px) result in width: 10vw;

i change px vw in similar way blur effect in filter.

how should change mixin if after calling .change-unit(filter, blur(5px)) want filter: blur(5vw);? possible?

you add third parameter when using filter modifies value:

.change-unit (@property, @value) {   @{property}: unit(@value, vw); }  .change-unit (@property, @value, @function) {   @converted: unit(@value, vw);   @{property}: ~'@{function}(@{converted})'; }  #no-filter {     .change-unit(width, 10px); }  #filter {     .change-unit(filter, 5px, blur);  } 

most of time use mixin as-is, when need use function, add name of function third parameter.


Comments

Popular posts from this blog

meteor - inserting data to database gives error "insert failed: Method '/texts/insert' not found" -

angular - DownloadURL return null in below code -