const path = require('path')
module.exports = {
  parser: require('postcss-comment'),
  plugins: [
    require('postcss-windicss-postcss7')({}),
    require('postcss-import')({
      resolve (id, basedir, importOptions) {
        if (id.startsWith('/')) {
          return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3))
        } else if (id.startsWith('@/')) {
          return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2))
        } else if (id.startsWith('/') && !id.startsWith('//')) {
          return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1))
        }
        return id
      }
    }),
    require('autoprefixer')({
      remove: process.env.UNI_PLATFORM !== 'h5'
    }),
    require('@dcloudio/vue-cli-plugin-uni/packages/postcss'),
    // require('postcss-class-rename')({
    //   [process.env.UNI_PLATFORM === 'mp-weixin' ? ':not\\\(\\\[hidden\\\]\\\)\\\s~\\\s:not\\\(\\\[hidden\\\]\\\)' : '不可能匹配的字符']: 'view + view', // 支持 space-x-4 语法
    //   '\\\\:': '_', // 变体写法 focus_bg-primary
    //   '\\\\/': '_', // 数值百分号 w-1_2
    //   '\\\\.': '__', // 小数点写法 w-1__5
    // })
  ]
}
