soda-x / postcss-plugin-px2rem

postcss plugin px2rem
192 stars 29 forks source link

支持多个单位配置,比如 rpx #3

Closed shepherdwind closed 7 years ago

shepherdwind commented 7 years ago

使用方式

    const input = 'h1 { margin: 0 0 20rpx 20rpx; font-size: 32px; line-height: 1.2; letter-spacing: 1rpx; }';
    const output = 'h1 { margin: 0 0 0.2rem 0.2rem; font-size: 0.64rem; line-height: 1.2; letter-spacing: 0.01rem; }';
    const processed = postcss(pxtorem({
      rootValue: { px: 50, rpx: 100 },
    })).process(input).css;

    expect(processed).toBe(output);
coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.2%) to 98.462% when pulling 67e1d509f9ad254ad6848bb77e397e4e457153b3 on shepherdwind:rpx-support into c4cf164336d0bc291d006a37cfee3d7ff876f587 on ant-tool:master.

soda-x commented 7 years ago

0.7.0