PostCSS 8.0 is coming

PostCSS is a tool for transforming CSS with JavaScript. It will auto prefix vendor specific code, add pollyfills to new CSS methods based on your browser support needs and more. Now PostCSS 8.0 will bring new API for plugins, which will make your CSS build faster and keep your node_modules smaller.

The most significant feature of PostCSS 8.0 will be a visitor API for plugins. PostCSS is the parser, which parses the CSS to an object tree (AST). Then plugins change this tree. In the end, PostCSS generates a new CSS string from a modified object tree.

Currently, every PostCSS plugin walks through this tree. Often a plugin is looking just for a few properties, but it still needs to scan the whole tree. If you have many plugins in your build tool (or you use one plugin preset with many plugins inside, like postcss-preset-env or stylelint), most of the processing time will be spent in plugins walking through the tree again and again.

An excerpt from PostCSS 8.0 is coming

View original article

Subscribe to our Newsletter

Add your email address and receive an email every Friday covering off everything worth knowing about building your websites responsively.