1.0.6 • Published 1 year ago

inline-px-to-viewport v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

linline-px-to-viewport

一个让vite专门处理react中关于内联style中px转vw的插件

install

npm install inline-px-to-viewport --save-dev

Use

vite

import InlinePx2Vw from 'inline-px-to-viewport';

export default function() {
  return {
    plugins: [
      InlinePx2Vw({
        viewportWidth: 750,
        unitPrecision: 5,
        viewportUnit: 'vw',
        minPixelValue: 1,
      }), // 放在第一个
      react(),
    ],
  };
}

option

默认配置

defaultsProp = {
  viewportWidth: 750,
  unitPrecision: 5,
  viewportUnit: 'vw',
  minPixelValue: 1
}

注意事项

如果不想转换这个px,可以将他大写或者直接数字不加px,如PX或者10,将不做处理

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago