const pkg = require('./package.json')
const dev = process.env.NODE_ENV === 'development'

module.exports = () => ({
    plugins: [
        // Preset Env
        require('postcss-preset-env')({}),

        // Autoprefixer
        require('autoprefixer')({}),

        // Extract media queries
        // require('postcss-combine-media-query')({}),

        // CSS Nano
        !dev && require('cssnano')({
            preset: 'default',
            autoprefixer: true,
            discardComments: { removeAll: true },
            calc: { precision: 2 },
            safe: true
        }),

        // Banner
        !dev && require('postcss-banner')({
            banner: `${pkg.name} v${pkg.version} \nBy ${pkg.author.name} \n${pkg.author.url}`
        })
    ]
})
