npm install pxtovw-loader -D
module.exports = {
// ...
Module: {
rule:[{
Test: /\. css $ /,
use: [{
loader: "style-loader"
}, {
Loader: "css-loader"
}, {
loader: "pxtovw-loader",
Options: {
unitToConvert:'px', //Custom conversion unit
viewportWidth: 1080, //Viewport width
unitPrecision: 5, //retain decimal places
minPixelValue: 2 // minimum conversion value
}
}]
}]
}
}
- configure viewport width
- Customize the unit to be converted
- Number of reserved digits after conversion
- Configure the minimum conversion value
- Customize the converted viewport unit
- Custom ignore selectors