You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I write margin: @line-height-base; I get margin: 1.25em; as expected. margin: (@line-height-base*2); get me margin: 2.5em; too.
But get-unit(@line-height-base) echoes an empty value and the unit is removed if the result of an operation with this value is negative. Eg. margin: (1 - @line-height-base); will generate margin: -0.25;
I guess it's logical the unit is lost after a division but why is it still there in some case?
Does it really solve your issue? i think with --strict-units=off1 - 1em is some kind of unpredictable, but the compiler takes the unit of the first number in this case where the (to remembered cause the --strict-units=off) unit of the second number seems to be lost due to the division.
i think the above should output 18em; for all three cases. The lost unit seems a bug.
Taking the above into account one could expect that in your situation possible using (-@line-height-base + 1); instead of (1 - @line-height-base); would help, but it does not, the unit has been lost already
I'll use strict units now so I guess my issue is fixed.
I don't really know what to say about the behavior I described. It wasn't what I expected but I guess neither less did expect my code.
Activity
bassjobsen commentedon Feb 23, 2015
you can see what happens when compiling the following code:
the above outputs:
The outcome of units in the above is (mathematically) as expected.
In your case
@line-height-baseis an division of twoemunits, and so the unit has been removed.Which cases?
You can apply
unit(value,em);to your divisions and multiplication to "force" it to em (which make mathematically no sense).unit(2em/2em,em)returns1emMatTheCat commentedon Feb 23, 2015
If
@line-height-basehas no unit how comesmargin: @line-height-base;givesmargin: 1.25em;?bassjobsen commentedon Feb 23, 2015
well, now i understand your question (sorry)
margin: @line-height-base; gives margin: 1.25em;because of the----strict-unitsoption has been setoff(default).echo "s{p:2em/2em}" | lessc -outputs:whilst
echo "s{p:2em/2em}" | lessc --strict-units=on -outputs:MatTheCat commentedon Feb 23, 2015
Oh I'm really sorry, I use less through assetic so I had no idea it had this option. Thanks for your time!
bassjobsen commentedon Feb 23, 2015
Does it really solve your issue? i think with
--strict-units=off1 - 1emis some kind of unpredictable, but the compiler takes the unit of the first number in this case where the (to remembered cause the--strict-units=off) unit of the second number seems to be lost due to the division.outputs:
i think the above should output
18em;for all three cases. The lost unit seems a bug.Taking the above into account one could expect that in your situation possible using
(-@line-height-base + 1);instead of(1 - @line-height-base);would help, but it does not, the unit has been lost alreadyMatTheCat commentedon Feb 23, 2015
I'll use strict units now so I guess my issue is fixed.
I don't really know what to say about the behavior I described. It wasn't what I expected but I guess neither less did expect my code.