Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6-7 webpack learn #4

Open
CaptainLiao opened this issue Jun 7, 2017 · 0 comments
Open

6-7 webpack learn #4

CaptainLiao opened this issue Jun 7, 2017 · 0 comments

Comments

@CaptainLiao
Copy link
Owner

CaptainLiao commented Jun 7, 2017

通过postcss-loader添加浏览器前缀

首先webpack.config.js中加载loader

module.exports = {
    //    __dirname是nodejs里的一个全局变量,他指向我们的根目录
    //entry入口文件路径
    entry: __dirname + '/app/main.js',
    //出口文件位置
    output: {
        path: __dirname + '/public', //出口文件位置
        filename: 'webpack.js' //出口文件名
    },
    module: {
        loaders: [
            {
                test: /\.css$/,
                loader: "style-loader!css-loader!postcss-loader"
            }
        ]
    }
}

我们在webpack.config.js的同级目录下新建postcss.config.js文件,配置如下

module.exports = {
  plugins: [
    require('autoprefixer')
  ]
}

接下来我们再来运行webpack就可以了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant