Taro 关闭 pxtransform 时,跨平台样式注释失效,NervJS/taro#11296
yarn add postcss-crossplatformcomments
postcss: {
pxtransform: {
enable: false,
config: {}
},
'postcss-crossplatformcomments': {
enable: true,
config: {
platform: process.env.TARO_ENV // rn|h5|weapp
}
}
}
postcss([
// autoprefixer({
// overrideBrowserslist: 'iOS >= 10, Chrome >= 49'
// }),
crossplatformcomments({ platform: ['h5'] }) // or platform: 'h5'
])
platform
can be a string or array. If you want config mutiple platforms thenplatform
option must be a array likeplatform: ['h5', 'weapp']
.