中文文档 传送门
A webpack plugin for px2scalability
Note: Please use with the px2scalability-loader
// support webpack 4
module.exports = (env, options) => {
// ...
plugins: [
new Px2scalabilityWebpackPlugin({
mode: options.mode
})
]
}
One raw stylesheet: index.scss
.selector {
width: 750px;
height: 75px;
font-size: 15px;
border: 1px solid #ddd; /*no*/
}
The plugin will create two css file:
vw version: index.0b4bc3579d5b57363002.css
.selector {
width: 100vw;
height: 10vw;
font-size: 2vw;
border: 1px solid #ddd; /*no*/
}
rem version: index.0b4bc3579d5b57363002.rem.css
.selector {
width: 10rem;
height: 1rem;
font-size: .2rem;
border: 1px solid #ddd; /*no*/
}
new Px2scalabilityWebpackPlugin({
'mode': 'production', // development || production
'suffix': 'rem'
})
- mode : The plugin creates file only in the mode is set production
- suffix : File suffix