1.0.0 • Published 5 years ago

postcss-px2vwh v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

postcss-px2vwh

you can use this plugin to convert 'px' to 'vw' or 'vh'.

how to use?

vue-cli3 vue.config.js

module.exports={
    css: {
        loaderOptions: {
            postcss: {
                plugins: [
                    require('postcss-px2vwh')({
                        width: 1920,                    //your psd's width
                        height: 1080,                   //your psd's height
                        reg: /\/h5\/[a-zA-Z0-9]*.vue$/  //which file will you convert
                    }),
                ]
            }
        }
    }
}

use

div{
    width:192vw;
    height:108vh;
    border:1px solid grey;
}

after compile

div{
    width:10vw;
    height:10vh;
    border:1px solid grey;
}