less.ruby icon indicating copy to clipboard operation
less.ruby copied to clipboard

Variables mixed/forgotten in dynamic mixin

Open hlidotbe opened this issue 15 years ago • 0 comments

When trying to use this dynamic mixin, values are incorrect:

.linear_gradient (@startleft: 0%, @starttop: 0%, @endright: 0%, @endbottom: 0%, @startfrom: #000000, @endto: #ffffff, @fallback: '') {
    background-image: url(@fallback);
    background-image: -webkit-gradient(linear, @startleft @starttop, @endright @endbottom, from(@startfrom), to(@endto));
    background-image: -moz-linear-gradient(@startfrom @starttop, @endto @endbottom);
}

Usage: .block.green { .linear_gradient(0%, 0%, 0%, 100%, #96d046, #70a22b, ''); }

Expected: .block.green { background-image: url(''); background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#96d046), to(#70a22b)); background-image: -moz-linear-gradient(#96d046 0%, #70a22b 100%); }

Result: .block.green { background-image: url(''); background-image: -webkit-gradient(linear, 0% 0%, 0% 0%, from(#96d046), to(#70a22b)); background-image: -moz-linear-gradient(#000000 0%, #ffffff 0%); }

Some variables are used once, some are ignored. I don't know what cause this, I have other mixins like this one for rounded corners and shadows and they work fine.

hlidotbe avatar Feb 01 '10 16:02 hlidotbe