postcss-px-to-viewport在vue的使用
2020-02-13 本文已影响0人
locky丶
安装包
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
})
]
}
}
}
}