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

Variable interpolation with math operator like + is not compiling properly #4258

Open
liuliangsir opened this issue Jan 5, 2024 · 3 comments
Labels

Comments

@liuliangsir
Copy link

To reproduce:

@a: 1px;
@b: 2px;
@c: @a + @b;

@radio-cls: radio;
@radio-cls-checked: @{radio-cls}_checked;

.@{radio-cls-checked} {
  border-color: #fff;
}

Also here is a online playground for reproducing the issue above.

Current behavior:

._checked {
  border-color: #fff;
}

Expected behavior:

.radio_checked {
  border-color: #fff;
}

Environment information:

  • less version: 4.2.0
  • nodejs version: N/A
  • operating system: N/A

Workaround

@liuliangsir liuliangsir added the bug label Jan 5, 2024
@liuliangsir
Copy link
Author

@iChenLei cc

@matthew-dean
Copy link
Member

@liuliangsir That's a fascinating and bizarre bug. The first statements should have no effect on the statement following but somehow they do. 🤔

@puckowski
Copy link
Contributor

I have a fix for this issue that passes all tests. I will try to submit a PR sometime this weekend.

puckowski added a commit to puckowski/less.js that referenced this issue Dec 8, 2024
* Fix rebase issue for fix for issue less#4258.
puckowski added a commit that referenced this issue Dec 8, 2024
* fix(issue:4258) variable interpolation after math

* Fixes variable interpolation issue after previous variable addition.

* chore: fix rebase issue

* Fix rebase issue for fix for issue #4258.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants