Open JuctTr opened 1 year ago
没必要这么搞吧,px该怎么写就怎么写,想转单位的话,自定义一个最好,比如小程序的rpx。 这样只把rpx转为vw,其他的不受影响。
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
'postcss-px-to-viewport-8-plugin': {
unitToConvert: 'rpx',
viewportWidth: 750,
viewportUnit: 'vw',
fontViewportUnit: 'vw',
mediaQuery: true,
include: [/assets/, /components/, /layouts/, /pages/, /public\/css/, /app\.vue/, /error\.vue/],
landscape: false,
landscapeUnit: 'vw',
landscapeWidth: 750,
},
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {}),
},
}
增加一个特性,如果是大写的 PX , 那么就扭转为小写的,忽略转换,保留原单位,如下:
input
output