Open mikerouxfr opened 7 years ago
I forgot to tell that i've tried to use the less unit
function in the mixin and that doesn't fix the issue.
That is why I think that the problem comes from the minifier.
Here is the workaround I've tried :
.move(@x; @y) {
@_x: unit(@x, px);
@_y: unit(@y, px);
@move: ~"translate(calc(@{_x} - 50%), calc(@{_y} - 50%))";
}
For those who may need a workaround, I used the following mixin declarations :
.move(@x; @y) when (unit(@x) = 0) and (unit(@y) = 0) { @move: ~"translate(-50%, -50%)"; }
.move(@x; @y) when (unit(@x) = 0) { @move: ~"translate(-50%, calc(@{y} - 50%))"; }
.move(@x; @y) when (unit(@y) = 0) { @move: ~"translate(calc(@{x} - 50%), -50%)"; }
.move(@x; @y) when (default()) { @move: ~"translate(calc(@{x} - 50%), calc(@{y} - 50%))"; }
We have just ran into this issue with our minified css files. Is there timeline for fixing this issue?
Installed product versions
Description
When minified,
0
values of the css calc function parameters lost the unit. That makes the browser raises aninvalid property value
error (ontransform
).Steps to recreate
Declare the following mixin :
Call it anywhere :
Inspect the element with your browser developers console. If you're in Debug mode and your site uses the main.css (unminified version), you won't have any issue. If you're in Release mode (or if you publish, or force usage of minified file) : -> You'll probably find out that the value of the transform property of the element is not valid (because on the calc function having a value without unit).
Current behavior
Expected behavior
or transform: translate(calc(10px - 50%), calc(- 50%))