0.0.4 • Published 6 years ago

postcss-px2rem-sgui v0.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

使用方法

 npm install postcss-px2rem-sgui

webpack

var px2rem = require('postcss-px2rem-sgui');

module.exports = {
  module: {
    loaders: [
      {
        test: /\.css$/,
        loader: "style-loader!css-loader!postcss-loader"
      }
    ]
  },
  postcss: function() {
    return [px2rem({
        remUnit: 75,    //remUnit针对开发过程中css进行转换
        uiRemUnit:37.5 //uiRemUnit针对依赖包转换比例,主要为解决目前开源移动端UI组件比例与 flexible适配方案兼容
        exclude: /node_modules/  //需要使用uiRemUnit的目录
    })];
  }
}

vue-cli3

vue.config.js

module.exports = {
  css: {
        loaderOptions: {
            postcss: {
                plugins: [
                    require('postcss-px2rem-sgui')({
                        remUnit: 75,
                        uiRremUnit:37.5,
                        exclude: /node_modules/
                    }), 
                ]
            }
        }
    }
}