postcss.config.js 746 B

12345678910111213141516171819202122
  1. const path = require('path')
  2. module.exports = {
  3. parser: require('postcss-comment'),
  4. plugins: [
  5. require('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. require('autoprefixer')({
  18. remove: process.env.UNI_PLATFORM !== 'h5'
  19. }),
  20. require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
  21. ]
  22. }