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

Support logical if() function (Less.js 3.0) #111

Open
toviet opened this issue Jul 15, 2024 · 3 comments
Open

Support logical if() function (Less.js 3.0) #111

toviet opened this issue Jul 15, 2024 · 3 comments
Labels
help welcome Type: Enhancement New feature or request

Comments

@toviet
Copy link

toviet commented Jul 15, 2024

Hi,

Is there any plan to support logical function that was added to less.js from version 3.0?

https://lesscss.org/functions/#logical-functions-if

Right now, when my less has an if condition i.e.:

if((@panelAlignment = flex-start), @exitPosition, auto);

I would get Unexpected Input exception when trying to parse the less content.

Thanks!

@Krinkle Krinkle changed the title Support Logical function Support logical if() function (Less.js 3.0) Jul 15, 2024
@Krinkle Krinkle added Type: Enhancement New feature or request help welcome labels Jul 15, 2024
@Krinkle
Copy link
Member

Krinkle commented Jul 15, 2024

Yes, it's on our roadmap for the 5.x release in our issue tracker at https://phabricator.wikimedia.org/T288498.

Would you be interested in helping start the relevant portion from the test/assets/lessjs-3.13.1.js file, or less/less.js#3079?

@toviet
Copy link
Author

toviet commented Jul 16, 2024

Thanks for your reply and it's great to know that a new release is coming to address this.

Unfortunately I'm all tied up at the moment so not sure if I could join the testing, but will let you know if I'm available.

Regarding the timeframe, do you have any estimated date when the new release is going to be ready? Sorry for being curious.

@Krinkle
Copy link
Member

Krinkle commented Jul 23, 2024

@toviet Less.php 5.1.0 should be out within 3-4 weeks, which will release several more Less.js 3.x features.

reedy pushed a commit to reedy/less.php that referenced this issue Oct 29, 2024
This implements the commentStore feature in the Less_Parser.

To be able to parse and re-inject comments we need to store
them in the commentStore instead of just eating up. In cases
where we cannot render comments the commentStore array will
be cleaned up.

This causes situations when instead of a single argument we
might pass the Less_Tree_Exception. As per less.js we
introduce the functionCaller (for now just a method instead
of additional class) that will clean up Expresssions from
comments before calling a function.

This fixes the following crash, and more generally preserves comments
in various places where we ate them previously.

```
bin/lessc test/Fixtures/lessjs-3.13.1/less/_main/comments2.less

ParseError: unmatched `/*` in comments2.less on line 4, column 53
2| @-webkit-keyframes hover /* Safari and Chrome */{  }
3| .bg {
4|   background-image: linear-gradient(#333 /*{comment}*/, wikimedia#111);
```

Bug: T353132
Change-Id: I99c42a1969762869023e91deb72f31773b43a06e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help welcome Type: Enhancement New feature or request
Development

No branches or pull requests

2 participants