const { compress } = require('csso').syntax;
const postcssToCsso = require('./lib/postcssToCsso.js');
const cssoToPostcss = require('./lib/cssoToPostcss.js');

module.exports = (options = {}) => ({
    postcssPlugin: 'postcss-csso',
    Once(root, { result, postcss }) {
        result.root = cssoToPostcss(compress(postcssToCsso(root), options).ast, postcss);
    }
});
module.exports.postcss = true;

const { compress } = require('csso').syntax;
const postcssToCsso = require('./lib/postcssToCsso.js');
const cssoToPostcss = require('./lib/cssoToPostcss.js');

module.exports = (options = {}) => ({
    postcssPlugin: 'postcss-csso',
    OnceExit(root, { result, postcss }) {
        result.root = cssoToPostcss(compress(postcssToCsso(root), options).ast, postcss);
    }
});
module.exports.postcss = true;

Replace `Once` with `OnceExit` to do the compression last
Replace `Once` with `OnceExit` to do the compression last