Skip to content

PostCSS Preset Env 8

Antonio Laguna edited this page Jun 27, 2022 · 32 revisions

We're very mindful of the impact that major releases have which is why we're trying to keep the changes well documented, well thought out and establish a good way to move forward.

As a quick summary, we're trying to achieve the following:

Closest to spec

A polyfill should be indistinguishable from the native behaviour

This has been our motto for a while! We've seen that specs rarely change, but they do! And also, over time, some plugins got some features that were not spec compliant. We've closely reviewed plugins and made corrections where applies.

Removing old links

Back when all of the plugins were moved to the monorepo (see announcement) we've been enforcing a consistent style among the plugins, both in terms of code style but also in file organization. This meant that links from unpkg hinted within plugins that require browser polyfills would have stopped working. To avoid creating more breaking changes, we had some script to copy to the old placement.

This script has now been removed so you will need to use the new locations if you were relying in the old ones.

Disabling side effects

As hinted back in January, we're now not enabling by default plugins that require a browser polyfill. We've seen that those are "expected" to work but the implication of having a separate polyfill bundled within your JavaScript pipeline made so those plugins were almost never bundled in reality.

Removing per-package CLI

There were some plugins that had CLI packages distributed and some that didn't, we remmediated that by creating a global CLI. While we don't recommend using the CLI as part of any pipeline, it's definitely useful when trying to quickly debug or demonstrate something.

We've removed those outliers that still kept an independent CLI so if you were relying on that, you should now migrate to use @csstools/csstools-cli

Impacted plugins

The following plugins have been impacted:

PostCSS Blank Pseudo breaking changes

Internal CLI has been removed. Old CDN urls have been removed.

How to migrate:

  • If you use a CDN url, please update it.
  • Re-build your CSS with the new version of the library.
- <script src="https://unpkg.com/css-blank-pseudo/browser"></script>
- <script src="https://unpkg.com/css-blank-pseudo/browser.min"></script>
+ <script src="https://unpkg.com/css-blank-pseudo/dist/browser-global.js"></script>
- cssBlankPseudo(document)
+ cssBlankPseudoInit()

PostCSS Has Pseudo breaking changes

PostCSS Preset Env breaking changes

enableClientSidePolyfills now defaults to false as opposed to true. This disables by default the following plugins:

These plugins require browser polyfills and transform your CSS in ways that makes you dependent on the browser polyfill. As these plugins are rarely used and can be harmful we prefer to have these disabled by default.

If you did rely on these transformations you should now pass the option as true as opposed as not needing to pass it:

postcssPresetEnv({
+  enableClientSidePolyfill: true
});

Prefers Color Scheme breaking changes

Clone this wiki locally