如果你希望部分 px 单位不被转换成 rpx 或者 rem ,最简单的做法就是在 px 单位中增加一个大写字母,例如 Px 或者 PX 这样,则会被转换插件忽略。如:
/* `px` is converted to `rem` */.convert { font-size: 16px; // converted to 1rem} /* `Px` or `PX` is ignored by `postcss-pxtorem` but still accepted by browsers */.ignore { border: 1Px solid; // ignored border-width: 2PX; // ignored}