A notice to cssnext users #32
Description
A third of a million weekly cssnext installs are about to get a deprecation notice redirecting them PostCSS Preset-Env, so let me explain what this project is, and what you need to know if you use cssnext.
What is PostCSS Preset-Env
PostCSS Preset-Env is a bundle of CSS polyfills and prollyfills applied at compile time. It is like Babel Preset-Env for CSS. And like Babel, there are less stable and more stable features you can use, but only the safer features are polyfilled by default. Related: The PostCSS Preset-Env homepage.
About features and changes
Disabling unstable features by default is an important departure from cssnext, and the change is to protect you and your team. This is because unstable features may change or disappear over time.
What should cssnext users do? They should take advantage of “stages”. Related: The cssdb staging process.
Like Babel, you can choose less stable or more stable features by specifying a “stage”. The stages are 0 - 4. The lower the stage number, the less stable the feature. Babel stages follow the TC39 staging process, and PostCSS stages follow the cssdb staging process.
cssnext users have been using many “Stage 0” features, and so the smoothest transition for your team may be to enable Stage 0 at first. Note: Nesting Rules are a Stage 0 feature.
Now, unlike Babel, PostCSS stages are not yet endorsed by or affiliated with a specification committee or browser vendor. If and when they are, that committee would likely be the CSSWG. I am actively trying to establish a partnership with them. Related: An issue to update cssdb with CSSWG feedback.
About browser support
Both Babel and PostCSS support a “browserslist”, which is a sharable configuration that determines the browsers your project is supporting. Babel and PostCSS use this configuration to omit polyfills for features that your target browsers already support.
About these projects
Babel and PostCSS were created to help developers accomplish real things with modern and emerging technologies. Both projects provide a great way for developers, authors, and implementors to communicate, thus improving the creation of standards, testing, feedback, and new use cases.
You can try PostCSS Preset-Env in the browser right now, and I hope you’ll consider using it in your next project. Thanks!