Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy variables of css custom properties with less functions (even if it's overwritten) will break building #3563

Open
weareoutman opened this issue Oct 16, 2020 · 12 comments · May be fixed by #3721

Comments

@weareoutman
Copy link

weareoutman commented Oct 16, 2020

To 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.

@kpaxqin
Copy link

kpaxqin commented Nov 16, 2020

Same issue in my project.

IMO the darken() should not been called since its already overridden.

@srfaytkn
Copy link

+1

@FengShangWuQi
Copy link

+1

@lucataglia
Copy link

Same issue, any news ? I also posted a question on stack overflow but no solution nor workaround yet.

@da-anda
Copy link

da-anda commented Jul 21, 2021

same issue

@iChenLei iChenLei self-assigned this Jul 21, 2021
@iChenLei
Copy link
Member

Sorry for slow response, I will investgate this issue. 🕵️

@snoweastcn
Copy link

same issue

@tusharrathi1993
Copy link

same issue

@crossan007
Copy link

I'm having a similar issue: #3611 (comment)

@crossan007
Copy link

Looks like #3721

@imaliouris
Copy link

Looks like #4275. Do we have any update this? It really blocks much of our work..

@nsika
Copy link

nsika commented Oct 18, 2024

Hitting the same issue when trying to use css variables in a UIkit theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.