-
-
Notifications
You must be signed in to change notification settings - Fork 78
PostCSS Preset Env 8
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:
A polyfill should be indistinguishable from the native behavior
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.
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 rely on the old ones.
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. Hence, those plugins were almost never bundled in reality.
There were some plugins that had CLI packages distributed and some that didn't, we remediated 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.
The following plugins have been impacted:
Internal CLI has been removed. Old CDN urls have been removed. Browser polyfill has updated the initialization.
- 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()
- cssBlankPseudo({
- attr: false,
- className: 'blank'
- })
+ cssBlankPseudoInit({
+ replaceWith: '.blank'
+ })
enableClientSidePolyfills
now defaults to false
as opposed to true
. This disables by default the following plugins:
- PostCSS Blank Pseudo
- PostCSS Focus Visible
- PostCSS Focus Within
- PostCSS Has Pseudo
- Prefers Color Scheme Query
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
});