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

Space in merge declaration causes CssSyntaxError #160

Open
bnickel opened this issue Jun 11, 2021 · 1 comment
Open

Space in merge declaration causes CssSyntaxError #160

bnickel opened this issue Jun 11, 2021 · 1 comment

Comments

@bnickel
Copy link

bnickel commented Jun 11, 2021

Less allows (or gracefully handles) spaces in merge declarations, like filter +_: blur(2px); but throws an exception in postcss. This happens inside after tokenization inside decl so it looks like the tokens could be sanitized before passing it to super.decl but I'm a bit out of my depths with whether or not that'll break something else.

  • Node Version: v12.13.1
  • NPM Version: 7.4.0
  • postcss Version: 8.1.2
  • postcss-less Version: 4.0.1

LESS

.test1
 {
   rule +_: 'value';
 }

JavaScript

const test = require('ava');
const { parse } = require('../../lib');

test('should not fail when spaces are in merge rules', (t) => {
  const less = `.test1
  {
    rule +_: 'value';
  }
`;

  parse(less);
});

Errors

CssSyntaxError

<css input>:3:11: Unknown word

Expected Behavior

The Less should parse maybe with prop: "rule+_" to match match the existing. Or both should have something like prop: "rule", merge: true. I'm just using stylelint so I'm unopinionated.

Actual Behavior

Exception thrown.

How can we reproduce the behavior?

Add the test to the repo or try it in stylelint.

@shellscape
Copy link
Owner

I'd welcome a pull request to resolve this.

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