css3 - LESS CSS parametric mixin default null value does not work -
i have lesscss mixin box-shadow
:
.box-shadow(@x, @y, @blur, @color, @addit: ''){ -webkit-box-shadow: @x @y @blur @color @addit; -moz-box-shadow: @x @y @blur @color @addit; box-shadow: @x @y @blur @color @addit; }
as seen, there parameter @addit
set ''
default.
it's work fine when give @addit
value : .box-shadow(0, 0, 2px, #1361aa, inset)
, why if parameter @addit not filled, doesn't work? , how fix it?
help, advance.
escape empty string default
you need set default value ~''
escaped string.
less
.box-shadow(@x, @y, @blur, @color, @addit: ~''){ -webkit-box-shadow: @x @y @blur @color @addit; -moz-box-shadow: @x @y @blur @color @addit; box-shadow: @x @y @blur @color @addit; } .test{ .box-shadow(0, 0, 2px, #1361aa) }
css
.test { -webkit-box-shadow: 0 0 2px #1361aa ; -moz-box-shadow: 0 0 2px #1361aa ; box-shadow: 0 0 2px #1361aa ; }
Comments
Post a Comment