The .lib-css()
mixin is used heavily in Magento 2 LESS files. However its purpose is not apparent, and the mixin definitions don't provide any helpful documentation:
// // Add any css property // --------------------------------------------- .lib-css( @_property, @_value, @_prefix: 0 ) when (@_prefix = 1) and not (@_value = '') and not (@_value = false) and not (extract(@_value, 1) = false) and not (extract(@_value, 2) = false) and not (extract(@_value, 3) = false) and not (extract(@_value, 4) = false) and not (extract(@_value, 5) = false) { -webkit-@{_property}: @_value; -moz-@{_property}: @_value; -ms-@{_property}: @_value; } .lib-css( @_property, @_value, @_prefix: 0 ) when not (@_value = '') and not (@_value = false) and not (extract(@_value, 1) = false) and not (extract(@_value, 2) = false) and not (extract(@_value, 3) = false) and not (extract(@_value, 4) = false) and not (extract(@_value, 5) = false) { @{_property}: @_value; }
I could see why you would want to use the mixin to add vendor prefixes to bleeding edge CSS properties (although there are few properties where that is necessary any more), but the reason for outputting normal CSS properties using this mixin is not clear. Can anyone shed light on this?