lessphp icon indicating copy to clipboard operation
lessphp copied to clipboard

Support calc method

Open kirschkern opened this issue 12 years ago • 3 comments

When using the calc method from CSS3, the less compiler changes my format.

height: calc(100% - 18px);

will become

height: calc(82%);

which is not what I want. I expect the value inside the calc brackets to remain as given. Any workaround?

kirschkern avatar Jun 05 '13 10:06 kirschkern

if you want to use the CSS3 calc instead of the less math computation, you have to escape the value. Otherwise, the math operation is done by less:

height: ~"calc(100% - 18px)"

stof avatar Jul 19 '13 13:07 stof

Looks like there was a long-running conversation about this on less.js: https://github.com/less/less.js/issues/974

mcordingley avatar Oct 03 '14 20:10 mcordingley

This just isn’t right. When I first got hit by the problem I did a search and read that StrictMath would solve the problem. I did and I thought the problem was solved—until today. I looked at the code in the debugger and found that the @ rule was left intact but the actual calc() call was mangled. Even if escaping were strictly mandatory it should at least always mangle calcs so that we don’t get random errors.

acli avatar Oct 07 '14 02:10 acli