postcss-pxtransform 3.4.0-beta.2 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -513,7 +513,7 @@ describe('platform 为 weapp', () => {
513
513
 
514
514
  it('{platform: \'weapp\', designWidth: 640} ', () => {
515
515
  const rules = 'h1 {margin: 0 0 20px;font-size: 40px;line-height: 1.2;}'
516
- const expected = 'h1 {margin: 0 0 17.09402rpx;font-size: 34.18803rpx;line-height: 1.2;}'
516
+ const expected = 'h1 {margin: 0 0 23.4rpx;font-size: 46.8rpx;line-height: 1.2;}'
517
517
  const options = {
518
518
  platform: 'weapp',
519
519
  designWidth: 640
package/index.js CHANGED
@@ -39,8 +39,8 @@ const DEFAULT_WEAPP_OPTIONS = {
39
39
 
40
40
  let targetUnit
41
41
 
42
- module.exports = postcss.plugin('postcss-pxtransform', function (options) {
43
- options = Object.assign(DEFAULT_WEAPP_OPTIONS, options || {})
42
+ module.exports = postcss.plugin('postcss-pxtransform', function (options = {}) {
43
+ options = Object.assign({}, DEFAULT_WEAPP_OPTIONS, options)
44
44
 
45
45
  switch (options.platform) {
46
46
  case 'h5': {
@@ -49,7 +49,7 @@ module.exports = postcss.plugin('postcss-pxtransform', function (options) {
49
49
  break
50
50
  }
51
51
  case 'rn': {
52
- options.rootValue = options.deviceRatio[options.designWidth] * 2
52
+ options.rootValue = 1 / options.deviceRatio[options.designWidth] * 2
53
53
  targetUnit = 'px'
54
54
  break
55
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-pxtransform",
3
- "version": "3.4.0-beta.2",
3
+ "version": "3.4.2",
4
4
  "description": "PostCSS plugin px 转小程序 rpx及h5 rem 单位",
5
5
  "keywords": [
6
6
  "postcss",
@@ -28,5 +28,5 @@
28
28
  "testEnvironment": "node"
29
29
  },
30
30
  "main": "index.js",
31
- "gitHead": "ac3eb29f11aec15d25e061775d9e970efabc2c98"
31
+ "gitHead": "26b329326c6a7da652e8d712ee33df01ab8d2d0e"
32
32
  }