postcss.config.js 726 B

123456789101112131415161718192021222324252627
  1. const or = (...args) => {
  2. const variableNames = args.filter(x => x.startsWith('--'))
  3. const initialValue = args.filter(x => !x.startsWith('--'))[0]
  4. return variableNames.reduceRight((memo, current) => {
  5. if (memo && current) {
  6. return `var(${current.trim()}, ${memo})`
  7. } else if (current) {
  8. return `var(${current.trim()})`
  9. } else if (memo) {
  10. return memo
  11. }
  12. }, initialValue)
  13. }
  14. module.exports = {
  15. plugins: {
  16. 'autoprefixer': {},
  17. 'postcss-import-ext-glob': {},
  18. 'postcss-import': {},
  19. 'postcss-functions': { functions: { or } },
  20. 'tailwindcss/nesting': 'postcss-nested',
  21. tailwindcss: {},
  22. ...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {})
  23. }
  24. }