songsiqi / px2rem

According to one stylesheet, generate rem version and @1x, @2x and @3x stylesheet.
558 stars 92 forks source link

配置vue不生效 也不报错 #21

Open wangjit opened 6 years ago

wangjit commented 6 years ago
{
  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'
    ],
  }
 }
}

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

WangXiZhu commented 6 years ago

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

fantasy525 commented 6 years ago

建议大家配置.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
    }

  }
}
WangXiZhu commented 6 years ago

参考了 http://www.txtlxg.com/228/dq674362263/article/details/78740820 (域名不能访问了)

wangjit commented 5 years ago

参考了 http://www.txtlxg.com/228/dq674362263/article/details/78740820,可用 @WangXiZhu 链接好像打不开

wangjit commented 5 years ago

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