vue.config.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. const { defineConfig } = require("@vue/cli-service");
  2. module.exports = defineConfig({
  3. transpileDependencies: true,
  4. css: {
  5. loaderOptions: {
  6. postcss: {
  7. postcssOptions: {
  8. plugins: [
  9. require("autoprefixer")({
  10. overrideBrowserslist: [
  11. "Android 4.1",
  12. "iOS 7.1",
  13. "Chrome > 31",
  14. "ff > 31",
  15. "ie >= 8",
  16. "last 10 versions", // 所有主流浏览器最近10版本用
  17. ],
  18. grid: true,
  19. }),
  20. require("postcss-pxtorem")({
  21. rootValue: 192, //设计稿宽度%10 比如 1920
  22. exclude: /(node_module)/, //默认false,可以(reg)利用正则表达式排除某些文件夹的方法,例如/(node_module|src)/
  23. propList: ["*"], //是一个存储哪些将被转换的属性列表,这里设置为["*"]全部,假设需要仅对边框进行设置,可以写]['*','!border*']
  24. //selectorBlackList :['.box'],//,那例如fs-xl类名,里面有关px的样式将不被转换,这里也支持正则写法。
  25. replace: true, //替换包含rems的规则。
  26. mediaQuery: false, //(布尔值)允许在媒体查询中转换px。
  27. minPixelValue: 0, //设置要替换的最小像素值(3px会被转rem)。 默认 0
  28. }),
  29. ],
  30. },
  31. },
  32. },
  33. },
  34. });