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

error with e() function (since 3.10.1) #3420

Closed
cor3000 opened this issue Aug 19, 2019 · 9 comments
Closed

error with e() function (since 3.10.1) #3420

cor3000 opened this issue Aug 19, 2019 · 9 comments

Comments

@cor3000
Copy link

cor3000 commented Aug 19, 2019

compile this less code containing using the e() function (using 3.10.1)

reproduced with node versions: 10.16 LTS, 12.7, 12.8.1

body {
    color: red;
}

e('anything to unquote');

result

SyntaxError: Quoted node returned by a function is not valid here in /home/robert/main.less on line 5, column 1:
4 
5 e('anything to unquote');
6 

the same less code compiles as expected in 3.9.0

maybe related to #3345

@matthew-dean
Copy link
Member

@cor3000 What are you trying to achieve? It's true you can't dump a quoted value in the root of a stylesheet, although I'm not sure why it worked before.

@matthew-dean
Copy link
Member

@cor3000 Oh no, you're right, I did change behavior of the e() function in a PR after 3.9.0. I hadn't yet added the changelog for it. -> 88e126b

@matthew-dean
Copy link
Member

@cor3000 It looks like I need to change the behavior to say that, yes, a quoted value is not allowed in the root, but an escaped quoted value is fine.

@cor3000
Copy link
Author

cor3000 commented Aug 20, 2019

I'm trying to what the documentation says: output " proprietary syntax which Less doesn't recognize."

In our case our css stylesheets contain non standard root level text that's processed at runtime.

@matthew-dean
Copy link
Member

@cor3000 I've set it as a high-priority bug, but not sure when I or someone else can get to it. Hopefully this week.

@cor3000
Copy link
Author

cor3000 commented Aug 21, 2019

Thanks, so far using 3.9.0 works for us.

matthew-dean added a commit to matthew-dean/less.js that referenced this issue Aug 22, 2019
matthew-dean added a commit that referenced this issue Aug 22, 2019
* Fixes #3423 #3420
* Proper fix without reverting previous fix
@cor3000
Copy link
Author

cor3000 commented Aug 23, 2019

How would I output a string like this, at root level?

e('<% taglib prefix="c" uri="http://someurl"%>');

I know this is not css but something our legacy pre-prossessor understands during runtime to add session specific information e.g. for locale dependent styles.

I.e. equivalent for unquote in sass...

https://sass-lang.com/documentation/functions/string#unquote

@matthew-dean
Copy link
Member

@cor3000 I just pushed a new version, should work.

@cor3000
Copy link
Author

cor3000 commented Aug 26, 2019

@matthew-dean thanks for the quick fix, works like a charm on 3.10.3

matthew-dean added a commit that referenced this issue May 5, 2020
* Fixes #3423 #3420
* Proper fix without reverting previous fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants