1
0

postcss.config.cjs 683 B

1234567891011121314151617181920212223242526
  1. // 根据 isH5 变量确定是否开启 H5 自适应模式
  2. const isH5 = true
  3. const autoprefixer = require('autoprefixer')
  4. const pxToViewport = require('postcss-px-to-viewport')
  5. module.exports = () => {
  6. // 添加 postcss 插件
  7. const plugins = [
  8. autoprefixer(),
  9. isH5
  10. ? pxToViewport({
  11. viewportWidth: 1080,
  12. mediaQuery: true,
  13. minPixelValue: 1,
  14. propList: ['*'],
  15. exclude: [/node_modules/], // 将第三方库的样式文件排除在转换之外
  16. selectorBlackList: ['.ignore', /van.*/] // 不转换 .ignore- 开头的类名,和 .van- 开头的类名
  17. })
  18. : null
  19. ]
  20. return {
  21. plugins
  22. }
  23. }