Skip to content

add support for toggling all subsequent unit translations#2

Open
sporeventexplosion wants to merge 1 commit intoyingye:masterfrom
sporeventexplosion:master
Open

add support for toggling all subsequent unit translations#2
sporeventexplosion wants to merge 1 commit intoyingye:masterfrom
sporeventexplosion:master

Conversation

@sporeventexplosion
Copy link
Copy Markdown

Make it possible to toggle px unit translations on and off for multiple declarations:

.style-a {
  margin: 16px;
}
/* postcss-px2units-disable */
.style-b {
  padding: 48px;
}
/* postcss-px2units-enable */
.style-c {
  font-size: 24px;
}

is transformed to

.style-a {
  margin: 16rpx;
}
.style-b {
  padding: 48px;
}
.style-c {
  font-size: 24rpx;
}

In some environments (such as many of the proprietary "miniprogram" runtimes), it may be desirable to style parts of a page with dimensions proportional to the page width and other parts with absolute "device pixel" dimensions. This can be done by using px and rpx units together. However, with the current version of postcss-px2units, a large number of /* no */ comments is needed if the developer wants to do this on a page with postcss-px2units enabled. This change makes it more concise to use the two units together.

@sporeventexplosion sporeventexplosion changed the title add support for disabling/enabling all subsequent unit translations add support for toggling all subsequent unit translations Jun 12, 2019
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.

1 participant