postcss_loader
老师用的版本是1,2之后就不能自定义属性了,要用postcss怎么处理的?
老师用的版本是1,2之后就不能自定义属性了,要用postcss怎么处理的?
2017-05-07
module:{
rules:[
{
test: /\.js$/,
loader:'babel-loader',
exclude: path.resolve(__dirname, 'node_modules'),
include: path.resolve(__dirname, 'src'),
// exclude:'./node_modules/',
// include:'./src/',
query:{
presets:['latest']
}
},
{
test: /\.css$/,
use:[
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 1
}
},
{
loader: 'postcss-loader',
// options: {
// plugins: function () {
// return [
// require('autoprefixer')
// ];
// }
// }
}
],
exclude: path.resolve(__dirname, 'node_modules'),
include: path.resolve(__dirname, 'src')
},
{
test:/\.less$/,
use:[
'style-loader',
'css-loader',
'postcss-loader',
'less-loader'
]
},
{
test:/\.scss$/,
use:[
'style-loader',
'css-loader',
'postcss-loader',
'sass-loader'
]
},
{
test:/.\html$/,
loader:'html-loader'
},
{
test:/.\.(png|jpg|jpeg|svg|gif)/i,
loader:'file-loader'
}
]
},
plugins:[
new webpack.LoaderOptionsPlugin({
options : {
postcss : function(){
return [
require('autoprefixer')({
broswers : ['last 5 versions']
})
];
}
}
}),
new htmlWebpackPlugin({
filename:'app.html',
template:'app.html',
inject:'head',//false 不注入 当手动注入到模板时
title:'webpack is app',
date: new Date(),
chunks:['main']
// excludeChunks
// minify: {
// removeComments:true,
// collapseWhitespace:true
// }
}),
new htmlWebpackPlugin({
filename:'a.html',
template:'index.html',
inject:'head',//false 不注入 当手动注入到模板时
title:'webpack is a',
date: new Date(),
chunks:['a']
// excludeChunks
// minify: {
// removeComments:true,
// collapseWhitespace:true
// }
}),
new htmlWebpackPlugin({
filename:'b.html',
template:'index.html',
inject:'head',//false 不注入 当手动注入到模板时
title:'webpack is b',
date: new Date(),
chunks:['b']
// minify: {
// removeComments:true,
// collapseWhitespace:true
// }
}),
new htmlWebpackPlugin({
filename:'c.html',
template:'index.html',
inject:'head',//false 不注入 当手动注入到模板时
title:'webpack is c',
date: new Date(),
chunks:['c']
// minify: {
// removeComments:true,
// collapseWhitespace:true
// }
})
]
举报