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

Add workarounds for postcss-values-parser error (negative values in calc()) #41004

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

feral-grimalkin
Copy link

Description

There's an issue popping up every so often (e.g. #37079) where postcss-values-parser returns a syntax error when dealing with negative values in calc(). This PR is trying to fix this issue in Bootstrap 5.3.3.

Motivation & Context

This is to satisfy postcss-values-parser to allow successfully compile Bootstrap 5.3.3 in for example Rails 6 project or other projects using webpacker.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Related issues

I think at the moment there might not be an open issue for this. PR #37079 solved a very similar issue in the past, this PR uses the same approach to the recently introduced issue.

@feral-grimalkin
Copy link
Author

Just to add some more context. This is not a bug in Bootstrap but in a css parser used in some pipelines. It was allegedly fixed in newer versions of the parser, but probably not backported, so it still affects some older projects. Updating the parser version might not be always possible given the spiderweb of dependencies.

Nevertheless as a very similar change was done in the past it'd make some sense to keep the code consistent, i.e. have calc(negative_value * #{$variable}) in all places. That said, it also doesn't feel very natural to now have calc(negative_value * #{$variable}) and calc(#{$variable} * positive_value) next to each other. 🤷

Copy link
Member

@louismaximepiton louismaximepiton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we missed it while changing some Sass variables but it seems logical to have this patch. Thanks for the patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Ready to merge
Development

Successfully merging this pull request may close these issues.

3 participants