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

Failed to parse less with variables in selector #1530

Closed
popov-tensor opened this issue Feb 18, 2021 · 1 comment
Closed

Failed to parse less with variables in selector #1530

popov-tensor opened this issue Feb 18, 2021 · 1 comment

Comments

@popov-tensor
Copy link

Here is my problem file test.less:

@country: entityCard_Country;
@pointer: __Choice_pointer;

.@{country}-DropdownItem .@{country}@{pointer}{
   cursor: pointer;
}

I use stylelint, but the error comes from postcss/lib/parser.js . Unfortunately, I don't understand it enough to fix. Actual behavior:

node $NBASE/stylelint/bin/stylelint.js --syntax less test.less

test.less
 4:27  ✖  Unknown word   CssSyntaxError

The same with postcss-cli:

node $NBASE/postcss-cli/bin/postcss --syntax postcss-less test.less
You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them in postcss.config.js.
CssSyntaxError: /home/local/REGION/de.popov/Project/stan/stan/test/cloud/Modules/Demo Interface/StyleLint/test.less:4:27: Unknown word

  2 | @pointer: __Choice_pointer;
  3 | 
> 4 | .@{country}-DropdownItem .@{country}@{pointer}{
    |                           ^
  5 |    cursor: pointer;
  6 | }

As I can see, this happens when several @{variable} substitutions are used in one selector. Parser fails on second one and the rest of file handling is skipped. When I check the same file with lessc --lint, it doesn't complain, syntax is ok.

Expected behavior: no syntax errors from postcss when no such errors from lessc.

@ai
Copy link
Member

ai commented Feb 18, 2021

You need to create an issue in postcss-less

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

No branches or pull requests

2 participants