Skip to content

Conversation

@chenyulun
Copy link

#75
PX unit support
postcss-pxtorem Can write PX without converting to REM, and browsers also support PX units

([0-9]+("."[0-9]*)?|"."[0-9]+)vmin\b return 'VMINS';
([0-9]+("."[0-9]*)?|"."[0-9]+)vmax\b return 'VMAXS';
([0-9]+("."[0-9]*)?|"."[0-9]+)\% return 'PERCENTAGE';
([0-9]+("."[0-9]*)?|"."[0-9]+)PX\b return 'PX';
Copy link
Collaborator

Choose a reason for hiding this comment

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

We already have px as LENGTH above on line 13.

And looks like this fix will not work 10pX and 10Px. It is better to make lower case before sending to parser.

Copy link
Author

Choose a reason for hiding this comment

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

We have enabled the plugin to convert PX to REM, and 50px to 1rem.

div{
  width: 50px; // 1rem
  width: calc(100% - 10PX); // calc(100% - 10PX)
  height: calc(10px - 10PX); // calc(0.2rem -10PX)
}

This CSS can be converted multiple times and needs to be uppercase at all times,and the browser supports PXPx

This issue also appeared in postcss-calc and they fixed it(7.0.4)

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.

2 participants