Packages

postcss

8.5.33 · 13 Nov 2026MIT443.1M / weekRepositoryHomepagenpmAtom feed

Your version

8.0.0

major15 Sep 2020Where it was published

8.5.33 is the newest release of 8.x.

In short

3 breaking13 new1 fixed12 changed1 internal

  • Breaking

    PostCSS 8 dropped Node.js 6.x, 8.x, 11.x, and 13.x versions support. All these versions have no security updates anymore.

  • Breaking

    We now serve ES6+ sources in the npm package without Babel compilation. If you are creating tools like CodePen and put PostCSS into the client-side JS bundle, you may need to run Babel on node_modules/postcss for old browsers.

  • Breaking

    We removed rarely used postcss.vendor API.

Security

Release note

PostCSS 8.0 brings new plugin API, node_modules size reduction, better source map support, and CSS parser improvements.

Check out a day-by-day diary of PostCSS 8.0 development process.

See Migration Guides for end-users and for plugin developers.

Breaking Changes

We try to avoid any breaking changes for end-users:

  • Breaking

    PostCSS 8 dropped Node.js 6.x, 8.x, 11.x, and 13.x versions support. All these versions have no security updates anymore.

  • Breaking

    We now serve ES6+ sources in the npm package without Babel compilation. If you are creating tools like CodePen and put PostCSS into the client-side JS bundle, you may need to run Babel on node_modules/postcss for old browsers.

  • Breaking

    We removed rarely used postcss.vendor API.

New Plugin API

The biggest change in PostCSS 8 is a new plugin API. Thanks to @BondarenkoAlex for big help in creating a new API.

module.exports = () => {
  return {
    postcssPlugin: 'postcss-will-change',
    Declaration: {
      'will-change': (decl, { Declaration }) => {
        decl.cloneBefore(
          new Declaration({ prop: 'backface-visibility', value: 'hidden' })
        )
      }
    }
  }
}
module.exports.postcss = true

We know that rewriting old plugins will take time, but the new API will improve the end-user’s experience and make life easier for plugin developers:

  • With new API, all plugins can share a single scan of the CSS tree. It makes CSS processing up to 20% faster.

  • Because npm often duplicates dependencies, you may have many postcss duplicates in your node_modules. New API fixes this problem.

  • Plugins will re-visit changed nodes to reduce compatibility issues between plugins. Now the order of plugins in your PostCSS config will be less important.

  • New API is close to Babel’s visitor API.

These resources will help plugin developers in API migration:

PostCSS development guidelines were also changed:

  • Now it is prohibited to create own AST on top of PostCSS AST classes since it could lead to painful bugs due to the usage private APIs.

  • Plugins and runners must have postcss in peerDependencies.

New Website without React

Previously PostCSS used a React-based framework for the project's website. Since we have a static website, we decided to migrate to a React-free framework and got good performance improvements:

  • 360 → 20 ms for Max Potential First Input Delay

  • 3.3 → 1.5 seconds for First CPU Idle

  • 3.3 → 1.5 seconds for Time to Interactive

Check out postcss.org and new API docs that feature the awesome alchemy-inspired design

We also removed Google Analytics tracking scripts and encourage other open source projects to be an example in caring about user’s privacy and performance.

Parser Improvments

Did you know that all examples below are valid CSS?

:root {
  --empty: ;
  --JSON: [1, "2", {"three": {"a":1}}, [4]];
  --javascript: function(rule) { console.log(rule) };
}

@supports (--element(".minwidth", { "minWidth": 300 })) {
  [--self] {
    background: greenyellow;
  }
}

Now PostCSS parses even those rare edge cases correctly. Thanks to Tailwind CSS and Prettier teams for adding more cases to our CSS parser tests collection.

Note that now --roundMixin: { border-radius: 8px } will be parsed as a Declaration with the { border-radius: 8px } value.

Better Source Map Support

We have added support for two new source map formats: Index map and JSON (data:application/json).

PostCSS 8 is now much closer to the source map spec. Thanks to the Google team for reports:

  • We now treat sources in map as URLs instead of file paths.

  • We now resolve sources relative to map file, not CSS file.

A few source map APIs were added:

  • opts.maps.absolute = true option for absolute paths in source map.

  • opts.maps.annotation = (file, root) => url for a dynamic path to source map.

  • Node#origin() now returns position.url in addition to position.file for compatibility with absolute URLs in source map’s sources.

API Changes

We have added ES modules support and now we export all classes from the main entry:

import { CssSyntaxError, parse } from "postcss"

@graberzz added Node#source.offset in addition to line and column.

CSS Custom Properties and Sass-like $-variables now have a special Declaration#variable mark:

const root = parse(`
  :root {
    --propery: value;
  }
  $variable: value
`)

root.first.first.variable //=> true
root.last.variable //=> true

TypeScript

PostCSS now has a first-class TypeScript support:

  • We moved API docs from JSDoc to TypeDoc. Check out our new API docs.

  • We keep types in separate files for better readability.

  • With the new structure and test system, we fixed many small issues in types.

Other Changes

  • Fixed calling replaceWith with input replaced node

  • Reduce dependencies by replacing chalk to colorette.

  • Added Declaration#value auto-conversion to string to prevent plugin’s bugs.

  • Fixed building PostCSS with Rollup

  • Moved unknown source from counter to random IDs: <input css 9M4X8l>:10:6.

  • Removed docs from the npm package.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.