Under the hood the plugin converts
PostCSS AST into
CSSO format, optimises it and converts back. The plugin uses either input
PostCSS tree nodes or their clones on reverse convertation. So shape of original
PostCSS tree nodes persists the same after compression in most cases (e.g. properties added by other plugins isn't lost). Also this allows to generate source map correctly.
Performance of the plugin is approximately the same as
CSSO has (see
CSSO numbers in comparison table).
If you have any difficulties with the output of this plugin, please use the CSSO tracker.
npm install postcss-csso
var postcss = ;var csso = ;;
Plugin accepts the same options as
compress() method of CSSO with no any changes.