Skip to content

Latest commit

 

History

History
42 lines (34 loc) · 861 Bytes

README_EN.md

File metadata and controls

42 lines (34 loc) · 861 Bytes

Webpack plugin for converting pixel units to vw

Use in project

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