postcss.config.js
701 Bytes
module.exports = {
"plugins": {
"postcss-pxtorem": {
rootValue: 37.5, // 75 表示 750 设计稿,37.5 表示 37.5 表示 375 设计稿
unitPrecision: 6, // 计算结果保留 6 位小数
selectorBlackList: ['.no-rem', 'no-rem'], // 要忽略的选择器并保留为px
propList: ['*'], // 可以从 px 更改为 rem 的属性 感叹号开头的不转化
replace: true, // 转换成 rem 以后,不保留原来的 px 单位属性
mediaQuery: true, // 允许在媒体查询中转换 px
minPixelValue: 2, // 设置要替换的最小像素值
// exclude: /node_modules/i // 排除 node_modules 文件(node_modules 内文件禁止转换)
}
}
}