安装包
npm install postcss-px-to-viewport --save-dev
package.json配置
{
"postcss": {
"plugins": {
"autoprefixer": {}
}
}
}
vue.config.js配置
const pxtoviewport = require('postcss-px-to-viewport')
module.exports = {
css: {
// 开启 CSS source maps?
sourceMap: true,
loaderOptions: {
postcss: {
plugins: [
autoprefixer(),
pxtoviewport({
viewportWidth: 375
})
]
}
}
}
}
网友评论