kirklin / postcss-px-conversion

A plugin for PostCSS that generates viewport units (vw, vh, vmin, vmax) from pixel units. The best choice to create a scalable interface on different displays by one design size.
https://postcss-px-conversion.vercel.app
MIT License
26 stars 2 forks source link

fix: allows the user to pass in non-enumerated values #5

Closed Kassell closed 1 month ago

Kassell commented 1 month ago

Proposed changes

Types of changes

What types of changes does your code introduce? Put an x in the boxes that apply

Linked Issues

Further comments

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
postcss-px-conversion ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 9, 2024 2:15pm
Kassell commented 1 month ago

Using an enumeration to define options prevents the user from passing in non-enumerated values

kirklin commented 1 month ago

Thank you for submitting the PR and for your efforts to improve the project! We greatly appreciate your contribution to the code.

we have adopted a more optimal approach to handle union types, ensuring that the code remains flexible while enhancing readability and type safety.

You can see the changes in this commit: 1219854.

Kassell commented 1 month ago

感谢您提交 PR 并为改进项目所做的努力!我们非常感谢您对代码的贡献。

我们采用了一种更优化的方法来处理联合类型,确保代码保持灵活性,同时增强了可读性和类型安全性。

You can see the changes in this commit: 1219854.

Have you considered what happens when users need to input values that aren't defined in the enumeration? Users would have to modify constants.ts in node_modules/postcss-px-conversion, or are you aware that enumeration classes cannot be inherited by other external classes, meaning that if users create a new enumeration and want to reference members of the old enumeration

kirklin commented 1 month ago

感谢您提交 PR 并为改进项目所做的努力!我们非常感谢您对代码的贡献。

我们采用了一种更优化的方法来处理联合类型,确保代码保持灵活性,同时增强了可读性和类型安全性。

You can see the changes in this commit: 1219854.

Have you considered what happens when users need to input values that aren't defined in the enumeration? Users would have to modify constants.ts in node_modules/postcss-px-conversion, or are you aware that enumeration classes cannot be inherited by other external classes, meaning that if users create a new enumeration and want to reference members of the old enumeration

The union type solves this problem (string & object);

Kassell commented 1 month ago

感谢您提交 PR 并为改进项目所做的努力!我们非常感谢您对代码的贡献。 我们采用了一种更优化的方法来处理联合类型,确保代码保持灵活性,同时增强了可读性和类型安全性。 You can see the changes in this commit: 1219854.

Have you considered what happens when users need to input values that aren't defined in the enumeration? Users would have to modify constants.ts in node_modules/postcss-px-conversion, or are you aware that enumeration classes cannot be inherited by other external classes, meaning that if users create a new enumeration and want to reference members of the old enumeration

The union type solves this problem (string & object);

I worked all day on Friday, and when I woke up on Saturday, I saw the notification that my PR was closed, which was a bit disappointing. I didn't pay too much attention to your reply at the time, and I'm very sorry for that. I see that the npm package has been updated 13 hours ago with a more elegant solution. That's great. I sincerely apologize for this.