webpack2.0配置postcss-loader的方法
本文介绍使用webpack2.0配置postcssloader,分享给大家。具体如下:
安装postcss-loader
npminstall--save-devpostcss-loader
然后配置webpack.config.js
{
test:/\.css$/,
use:[
'style-loader','css-loader?importLoaders=1','postcss-loader'
]
}
一种办法是配置postcss.config.js
module.exports={
plugins:[
require('autoprefixer')({/*...options*/})
]
}
第二张办法是webpack.config.js使用LoaderOptionsPlugin
module.exports={
plugins:[
newwebpack.LoaderOptionsPlugin({
options:{
postcss:function(){
return[
require("autoprefixer")({
browsers:['ie>=8','>1%inCN']
})
]
}
}
})
]
}
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。