postcss-config-ivan
v0.0.6
Published
postcss配置
Downloads
6
Readme
postcss-config-ivan
是否px转换为rem
在项目中package.json文件中的congfig.ispxtorem(Boolean)属性决定是否转换
postcss在webpack中配置
先安装必备包
npm install --save-dev postcss-config-ivan
在webpack3.0配置添加在modules.rules下:
{
test: /\.(css|scss)$/,
use: ExtractTextPlugin.extract({
fallback: require.resolve('style-loader'),
use: [{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
sourceMap: true,
},
},
// 实际配置-begin
{
loader: require.resolve('postcss-loader'),
options: {
ident: 'postcss',
config: {
path: require.resolve('postcss-config-ivan'),
},
sourceMap: true,
},
},
// 实际配置-end
require.resolve('resolve-url-loader'),
{
loader: require.resolve('sass-loader'),
options: {
sourceMap: true,
},
},
],
}),
},
// 文