webpack2.0配置postcssloader
npm install --save-dev postcss-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: [
new webpack.LoaderOptionsPlugin({
options: {
postcss: function(){
return [
require("autoprefixer")({
browsers: ['ie>=8','>1% in CN']
})
]
}
}
})
]
}
原文链接:https://www.cnblogs.com/qiqi715/p/9339204.html
本文来源 爱码网,其版权均为 原网址 所有 与本站无关,文章内容系作者个人观点,不代表 本站 对观点赞同或支持。如需转载,请注明文章来源。
© 版权声明
文章版权归作者所有,未经允许请勿转载。