songsiqi / px2rem

According to one stylesheet, generate rem version and @1x, @2x and @3x stylesheet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

配置vue不生效 也不报错

wangjit opened this issue · comments

{
  test: /\.vue$/,
  loader: 'vue-loader',
  options: {
  loaders:{
    css: [
      'vue-style-loader',
      'css-loader',
        {
          loader:'px2rem-loader',
          options: {
            remUnit: 75,
            remPrecision: 8
          }
       }
    ],
    scss: [
      'vue-style-loader',
      'css-loader',
        {
          loader:'px2rem-loader',
          options: {
            remUnit: 75,
            remPrecision: 8
          }
        },
      'sass-loader'
    ],
  }
 }
}

如上代码 不生效 也不报错,看了好多次文档

commented

@wangjit 请问目前解决了吗? 遇到同样的问题 需要将vue中css单位转换为 rem

建议大家配置.postcssrc.js来使用这个插件


module.exports = {
  "plugins": {
    "postcss-import": {},
    "postcss-url": {},
    // to edit target browsers: use "browserslist" field in package.json
    "autoprefixer": {},
    "postcss-px2rem": {
      remUnit: 192,
      baseDpr:1.5
    }

  }
}

@fantasy525 具体怎么做?看得不太明白