CSS minify und watch mit Postcss

Bash
npm i -D postcss postcss-cli cssnano autoprefixer onchange
JSON
{
  "name": "postcss",
  "version": "1.0.0",
  "scripts": {
    "build": "postcss src/style.css -o dist/style.min.css",
    "dev": "onchange \"src/**/*.css\" -- npm run build"
  },
  "devDependencies": {
    "autoprefixer": "^10.4.21",
    "cssnano": "^7.1.0",
    "onchange": "^7.1.0",
    "postcss": "^8.5.6",
    "postcss-cli": "^11.0.1"
  }
}
JavaScript
module.exports = {
  plugins: [
    require('autoprefixer'),
    require('cssnano')({ preset: 'default' })
  ]
};
Bash
dist
src/style.css