postcss.config.js 800 B

123456789101112131415161718192021222324252627282930
  1. // 使用 @vue/cli autoprefixer 依赖,如使用严格包管理模式需要兼容处理
  2. const autoprefixer = require('autoprefixer')
  3. const pxtoviewport = require('@jonny1994/postcss-px-to-viewport')
  4. // const envBook = process.argv.includes('config/storybook')
  5. const envBook = false
  6. let plugins = []
  7. if (!envBook) {
  8. plugins = [
  9. autoprefixer,
  10. pxtoviewport({
  11. unitToConvert: 'px',
  12. viewportWidth: 375,
  13. unitPrecision: 3,
  14. propList: ['*'],
  15. viewportUnit: 'vw',
  16. fontViewportUnit: 'vw',
  17. selectorBlackList: [],
  18. // 小于或等于 1px 的像素值不进行转换
  19. minPixelValue: 1,
  20. mediaQuery: false,
  21. // 兼容 vant 需要去掉此处
  22. // exclude: [/node_modules/],
  23. replace: true
  24. })
  25. ]
  26. }
  27. module.exports = {
  28. plugins
  29. }