PostCSS


PostCSS is a software development tool that uses JavaScript-based plugins to automate routine CSS operations. It was designed by Andrey Sitnik with the idea taking its origin in his front-end work for Evil Martians.

Functionality

PostCSS is a framework to develop CSS tools. It can be used to develop a template language such as Sass and LESS.
The PostCSS core consists of:
Features are made available through plugins. The plugins are small programs working with the object tree. After the core has transformed a CSS string into an object tree, the plugins analyze and change the tree. Then PostCSS generates a new CSS string for the plugin-changed tree.
PostCSS and its plugins are written in JavaScript and distributed through npm, which offer APIs for low-level JavaScript operations.
There are official tools making it possible to use PostCSS with build systems such as Webpack, Gulp, and Grunt. There is also a console interface available. Browserify or Webpack can be used to open PostCSS in a browser.

Syntaxes

PostCSS allows changing the parser and generator. In this case, PostCSS could be used to work with the Less and SCSS sources. However, PostCSS on its own cannot compile Sass or Less to CSS. What it does is change the original files — for instance, by sorting the CSS properties or checking the code for mistakes. PostCSS supports SugarSS.

Plugins

PostCSS plugins perform different CSS processing tasks ranging from analysis and properties sorting to minification.
The complete plugin list can be found on postcss.parts, with some examples listed below.
During the course of the Rework project, the idea of modular CSS processing was suggested by TJ Holowaychuk September 1, 2012. February 28, 2013, TJ expressed it in public.
March 14, 2013, Andrey Sitnik's front-end work for Evil Martians resulted in Autoprefixer, a Rework-based plugin. Initially, the plugin name was rework-vendors.
As Autoprefixer grew, Rework could no longer to meet its needs. September 7, 2013, Andrey Sitnik started to develop PostCSS based on the Rework ideas.
In 3 months, the first PostCSS plugin, grunt-pixrem was released. December 22, 2013, Autoprefixer version 1.0 migrated to PostCSS.
For PostCSS, the primary style focus is alchemy. The project logo represents the philosopher's stone. Major and minor PostCSS versions get their names after the Ars Goetia demons. For instance, version 1.0.0 is called Marquis Decarabia.
The term postprocessor has caused some confusion. The PostCSS team used the term to show that PostCSS was not a template language but a CSS tool. However, some developers think the term postprocessor would better suit browser tools. The situation has become even more complicated after the release of PreCSS. Now, instead of postprocessor, the PostCSS team use the term processor.