API Reference

PostCSS

A tool for transforming CSS with JavaScript plugins, used by autoprefixer, Tailwind, and build pipelines.

Official Documentation ↗
CompatibilityThis documentation covers version v8.4. Check the official docs for the latest API surface.

Installation

npmnpm install postcss

Methods

PostCSS parses CSS into an AST, runs plugins over it, and generates updated CSS.

Key Features

  • Plugin-based CSS transformation
  • AST with lazy source maps
  • Works with any bundler via postcss-loader

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

API reference evidence

Fetched from official sources on 2026-11-08T19:58:23+08:00 via WebFetch https://postcss.org/api/;WebFetch https://cdn.jsdelivr.net/npm/[email protected]/lib/postcss.d.ts(raw main 分支 lib/postcss.d.ts 返回空;lib/processor.d.ts 未抓取).

FAQ

How do I add a plugin?
Pass it to postcss([plugin]) or list it in postcss.config.js so build tools pick it up automatically.
Why are my source maps wrong?
Set the from and to options explicitly. PostCSS needs from to resolve relative imports and produce an accurate map.
Can PostCSS minify CSS?
Not by itself. Add cssnano as a plugin; PostCSS only provides the plugin execution pipeline.