Parses CSS into an AST and runs JavaScript plugins to lint, prefix, nest rules, inline assets, and apply other style transforms in build pipelines.
Overview
PostCSS takes a stylesheet, parses it into an abstract syntax tree, and lets plugins analyze or rewrite rules through a shared API. Hundreds of community plugins handle vendor prefixes, future syntax, modules, linting, minification, and more.
Popular ecosystem pieces mentioned in the project include Autoprefixer and Stylelint. Plugins can target plain CSS or alternate syntaxes via additional parsers for SCSS, Less, SugarSS, HTML, Markdown, and CSS-in-JS sources.
It integrates with webpack, Parcel, Gulp, npm scripts through postcss-cli, and can run in the browser via bundlers. A JavaScript API is available for custom runners that follow the project’s runner guidelines.
Editor support exists for VS Code, Sublime Text, Vim, and WebStorm, and the core is used by large web properties in production build chains.
Key features
- Plugin-based CSS AST transforms
- Large third-party plugin ecosystem
- Autoprefixer and Stylelint integration
- Multiple syntax parsers
- Source map support
- Webpack and Parcel loaders
- postcss-cli for npm scripts
- JavaScript runner API
Use cases
- Build-time CSS autoprefixing
- Stylesheet linting in CI
- Future CSS syntax polyfilling
- Scoped CSS modules in components