postcss.config.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. const path = require('path')
  2. module.exports = {
  3. parser: 'postcss-comment',
  4. plugins: {
  5. 'postcss-import': {
  6. resolve(id, basedir, importOptions) {
  7. if (id.startsWith('~@/')) {
  8. return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3))
  9. } else if (id.startsWith('@/')) {
  10. return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2))
  11. } else if (id.startsWith('/') && !id.startsWith('//')) {
  12. return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1))
  13. }
  14. return id
  15. }
  16. },
  17. 'autoprefixer': {
  18. overrideBrowserslist: ["Android >= 4", "ios >= 8"],
  19. remove: process.env.UNI_PLATFORM !== 'h5'
  20. },
  21. 'postcss-px-to-viewport': {
  22. unitToConvert: 'rpx',
  23. viewportWidth: 200,
  24. unitPrecision: 5,
  25. propList: ['*'],
  26. viewportUnit: 'px',
  27. fontViewportUnit: 'px',
  28. selectorBlackList: [],
  29. minPixelValue: 1,
  30. mediaQuery: false,
  31. replace: true,
  32. exclude: undefined,
  33. include: undefined,
  34. landscape: false
  35. },
  36. '@dcloudio/vue-cli-plugin-uni/packages/postcss': {}
  37. }
  38. }