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

Use custom parser instead of postcss-safe-parser #2

Merged
merged 2 commits into from
Mar 14, 2019

Conversation

TrevorBurnham
Copy link
Owner

This PR effectively reverts 20e5242, which broke an existing test case. 😓 It also changes the parser used by the postcss plugins, which fixes a new test case and I think the case that 20e5242 was intended to solve (must confirm!).

Explanation

When postcss-safe-parser sees code like

&& {
  color: black;
  PLACEHOLDER_PATTERN;
}

it sees that PLACEHOLDER_PATTERN; isn't valid CSS syntax, so it treats it as whitespace. This is a problem for us because postcss-nested makes no effort to keep whitespace in the same block (or any block, for that matter), yielding

.namespace && {
  color: black;
}

PLACEHOLDER_PATTERN;

The fix here is to use a modified version of postcss-safe-parser that treats these "unknown words" as declarations instead, yielding

.namespace && {
  color: black;
  PLACEHOLDER_PATTERN;
}

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

Successfully merging this pull request may close these issues.

None yet

1 participant