Add workarounds for postcss-values-parser error (negative values in calc())#41004
Conversation
|
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 |
louismaximepiton
left a comment
There was a problem hiding this comment.
I think we missed it while changing some Sass variables but it seems logical to have this patch. Thanks for the patch!
julien-deramond
left a comment
There was a problem hiding this comment.
Thanks for the PR @feral-grimalkin
Globally, this syntax is more conventional so let's make this consistent in the entire codebase. I haven't spotted any issues with manual testing. I'm always careful with @if $pagination-margin-start == calc(-1 * #{$pagination-border-width}) as the order is important in the comparison, but it seems to work well.
In the generated bootstrap.css, the diff seems safe as well:
2782c2782
< margin-left: calc(var(--bs-border-width) * -1);
---
> margin-left: calc(-1 * var(--bs-border-width));
3755c3755
< margin-left: calc(var(--bs-border-width) * -1);
---
> margin-left: calc(-1 * var(--bs-border-width));
3802c3802
< margin-top: calc(var(--bs-border-width) * -1);
---
> margin-top: calc(-1 * var(--bs-border-width));
4803c4803
< margin-left: calc(var(--bs-border-width) * -1);
---
> margin-left: calc(-1 * var(--bs-border-width));I'll add @louismaximepiton as a co-author as the same fix was suggested in #39108
Description
There's an issue popping up every so often (e.g. #37079) where
postcss-values-parserreturns a syntax error when dealing with negative values incalc(). This PR is trying to fix this issue in Bootstrap 5.3.3.Motivation & Context
This is to satisfy
postcss-values-parserto allow successfully compile Bootstrap 5.3.3 in for example Rails 6 project or other projects using webpacker.Type of changes
Checklist
npm run lint)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.