webpack实现px自动动转换成rem

1、px2rem-loader

 

{
    test: /.less$/,
    use: [
        MiniCssExtractPlugin.loader,
        'css-loader',
        {
            loader: 'px2rem-loader',
            options: {
                remUnit: 75,
                remPrecision: 8
                    }
        },
        'less-loader',
        {
            loader: 'postcss-loader',
            options: {
                plugins: () => [
                    require('autoprefixer')({
                        browsers: ['last 2 version', '>1%', 'ios 7']
                                            })
                                ]
                    }
        }
        ]
  },


 

 

<head>
<link href="./meta.html?__inline">
<title>Document</title>
<script type="text/javascript" src="../../node_modules/lib-flexible/flexible.js?__inline"></script>
</head>

 

©️2020 CSDN 皮肤主题: 1024 设计师:上身试试 返回首页