wepy-plugin-any2rpx

1.0.0 • Public • Published

wepy-plugin-any2rpx

wepy 插件,转化任意css单位至rpx

安装

  $ npm i -D wepy-plugin-any2rpx

使用

wepy.config.js

module.exports.plugins = {
  any2rpx: {
    filter: /\.(wxml|wxss)$/,
    config: {
      exclude: '1px',
      transform: [{
        unit: 'px',
        proportion: 1
      }]
    }
  }
}

配置

  • filter 监听的文件后缀
    默认: /\.(wxml|wxss)$/

  • config 具体配置

    • config.exclude 例外, 例如'1px'
      默认: 无

    • config.transform 转化规则数组, 可配置多项
      默认:

      {
        unit: 'px', //转化单位
        proportion: 1 //转化系数=rpx/unit
      }
      

注意

wxml内只转换普通内联样式,变量形式的:style="{{...}}"不会转换

Readme

Keywords

Package Sidebar

Install

npm i wepy-plugin-any2rpx

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

8.7 kB

Total Files

6

Last publish

Collaborators

  • ryzon