一、postcss-loader简介

二、基本配置

module.exports = {
    module:{
        rules:[
            {
                test:/\.(css|scss)$/,
                use:[
                    {loader:"style-loader"},
                    {loader:"css-loader"},
                    {loader:"postcss-loader"},
                    {loader:"sass-loader"}
                ]
            }
        ]
    }
}

另外注意的是需要在package.json的同级目录下面创建postcss.config.js文件

module.exports = {
    plugins:[
        require("autoprefixer")({
            overrideBrowserslist:[
                "defaults",
                "Android 4.1",
                "iOS 7.1",
                "Chrome>31",
                "ff>31",
                "ie>=8",
                "last 2 versions",
                ">0%"
            ]
        })
    ]
}

 

01-08 22:57