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

[Feature Request]: Support for min() and max() #189

Open
1 task
arayutw opened this issue May 17, 2023 · 1 comment
Open
1 task

[Feature Request]: Support for min() and max() #189

arayutw opened this issue May 17, 2023 · 1 comment

Comments

@arayutw
Copy link

arayutw commented May 17, 2023

What should be improved?

I would like min() and max() to shrink similar to calc().
Within these functions, calculations can be performed without using calc(). So, it would be helpful if they can also perform shrinking similar to calc().

Describe the solution you would like

width: min(360px, 100% - 24px - 24px)

=>

width: min(360px, 100% - 48px)

Possible alternatives

I would be happy to consider your request, even though it is unsolicited.

Additional context

No response

Are you willing to work on this?

  • Yes, I would like to help
@ludofischer
Copy link
Collaborator

That would be a good feature, in all likelihood you would need to go into https://github.com/postcss/postcss-calc/blob/master/src/lib/reducer.js, and stect max() or min() when the node type is Function. The only problem is if there is not enough information in the AST to do that, unfortunately the parser is generated by an unmaintained port of the Bison parser generator and is unwieldy to work with.

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