Lazy variables of css custom properties with less functions (even if it's overwritten) will break building
See original GitHub issueTo simplify the issue, let’s assume a third-party-library which contains:
// `library/style.less`
@base-color: green;
@dark-color: darken(@base-color, 50%);
.some-class {
color: @base-color;
backgroundColor: @dark-color;
}
And my app would like to override the colors to css custom properties:
// app.less
import "~library/style.less";
@base-color: var(--primary-color);
@dark-color: var(--bg-color);
:root {
--primary-color: #fff;
--bg-color: #000;
}
html[data-theme="dark"] {
--primary-color: #000;
--bg-color: #fff;
}
In which I want to override both the @base-color
and @dark-color
less variables. However, the less will fail with LessError: error evaluating function `darken`: Argument cannot be evaluated to a color
, even if the @dark-color
in library is actually overridden in my app, and no darken()
function should be called.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Breaking CSS Custom Properties out of :root Might Be a Good ...
The main reason that :root is suggested is because CSS isn't only used to style HTML documents. It is also used for XML...
Read more >Features In-Depth | Less.js
Less extends CSS with dynamic behavior such as variables, mixins, operations and functions. Less runs on both the server-side (with Node.js and Rhino)...
Read more >Using CSS custom properties (variables) - MDN Web Docs
Custom property fallback values Using the var() function, you can define multiple fallback values when the given variable is not yet defined; ...
Read more >A Strategy Guide To CSS Custom Properties
CSS Custom Properties (sometimes known as 'CSS variables') are ... or their scope can be limited to specific functions or blocks of code....
Read more >Safari Technology Preview Release Notes - Apple Developer
toMatrix() to throw an exception if its length is not compatible with a px unit ... Fixed CSS.supports returning false for custom properties...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for slow response, I will investgate this issue. 🕵️
Looks like https://github.com/less/less.js/pull/3721