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

fix: support parsing */ expressions without surrounding spaces #144

Merged
merged 1 commit into from Jan 7, 2022

Conversation

cyjake
Copy link
Contributor

@cyjake cyjake commented Nov 22, 2021

fixes #138

This PR contains:

  • bugfix
  • feature
  • refactor
  • tests
  • documentation
  • metadata

Breaking Changes?

  • yes
  • no

If yes, please describe the breakage.

Please Describe Your Changes

The tokens returned by postcss does not split chunk like *var, which causes expressions that containing * or / operations without surrounding spaces to break. This PR checks the value before letting them go through Func, and tokenize further with Operator instead, therefore fixes the issue.

  • / is tricky to determine because url(/foo/bar.jpg) is totally legit as well. Is there any means that can be used to determine current context is truly an expression in calc()?

@cyjake
Copy link
Contributor Author

cyjake commented Nov 22, 2021

If calc() context cannot be determined, I think a partial fix that handles * without surrounding spaces still suffices a PR. Context checked with this.lastNode.type === 'func'

@cyjake cyjake changed the title [wip] fix: support parsing */ expressions without surrounding spaces fix: support parsing */ expressions without surrounding spaces Nov 23, 2021
@cyjake
Copy link
Contributor Author

cyjake commented Nov 23, 2021

@shellscape pr is ready now :-)

@shellscape shellscape merged commit b143c3a into shellscape:master Jan 7, 2022
@shellscape
Copy link
Owner

thanks!

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.

Cannot parse calculations without spaces around the * operator
2 participants