Less.js: Less doesn't support new math functions (e.g. min, max)

Created on 16 Jan 2020  路  4Comments  路  Source: less/less.js

border-width: max(.01rem, 1px);

This code will break compile process.

feature request high priority

Most helpful comment

Note: This is likely also true for the related clamp() function.

A workaround

For anyone coming across this needing a workaround, you can always use LESS' string escaping capabilities to pass along a plain string to the CSS, eg.

border-width: ~"max(.01rem, 1px)";

All 4 comments

Note: This is likely also true for the related clamp() function.

A workaround

For anyone coming across this needing a workaround, you can always use LESS' string escaping capabilities to pass along a plain string to the CSS, eg.

border-width: ~"max(.01rem, 1px)";

@kbav Thanks锛宼hat's really helpful!

If you need to use Less variables, e.g. max(@my-var, 1px), you can do

@my-var: .01rem;
--my-var: @my-var;
border-width: ~"max(var(--my-var), 1px)";

Should be working as of Less 4

Was this page helpful?
0 / 5 - 0 ratings

Related issues

awebdev picture awebdev  路  4Comments

vecerek picture vecerek  路  5Comments

Oskariok picture Oskariok  路  6Comments

seven-phases-max picture seven-phases-max  路  6Comments

xblakestone picture xblakestone  路  3Comments