PostCSS is a CSS post-processor and syntax transformer that uses JavaScript plugins to parse and transform stylesheets. Stable version 8.x, actively maintained with monthly minor/patch releases. Key differentiators: plugin-driven architecture (over 200 plugins), supports future CSS syntax via plugins like postcss-preset-env, used by popular tools like Autoprefixer and Stylelint. Ships TypeScript definitions, supports ESM and CJS, requires Node.js 10+ (12+ for full features). Provides a fast CSS parser with source map support and a rich plugin API.
npm install postcssNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic PostCSS usage with Autoprefixer plugin: parse CSS, apply plugins, get output string.
Upgrade to Node.js 16+.
Always pass an array of plugins: postcss([...]).process(css).
Use import postcss from 'postcss' with esModuleInterop enabled in tsconfig.json.
Wrap in try/catch or use .catch() on the promise returned by .process().
Use postcss-scss or postcss-syntax packages for non-standard syntax.
Write plugins as functions directly: (root, result) => { ... }.Always pass both 'from' and 'to' (or at least 'from') to .process().
Use await postcss([...]).process(css) or properly chain .then()
Upgrade autoprefixer to 10.x for PostCSS 8: npm install autoprefixer@latest
Run npm install postcss --save-dev
Import Root from 'postcss/lib/root' or use postcss.parse() which returns a Root node