Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

postcss-clean

leodido73.7kMIT1.2.2

PostCSS plugin to minify CSS with clean-css

postcss, css, postcss-plugin, clean-css, minifier, minify, minification, optimisation, optimization, optimise, optimize, compress, compression

readme

postcss-clean GitHub Workflow Status (branch) NPM Coveralls branch NPM Monthly Downloads

PostCss plugin to minify your CSS

Compression will be handled by clean-css, which according to this benchmark is one of the top (probably the best) libraries for minifying CSS.

Install

With npm do:

npm install postcss-clean --save

Example

Input

.try {
  color: #607d8b;
  width: 32px;
}

Output

.try{color:#607d8b;width:32px}

Input

:host {
  display: block;
}

:host ::content {
  & > * {
    color: var(--primary-color);
  }
}

Output

:host{display:block}:host ::content>*{color:var(--my-color)}

Note this example assumes you combined postcss-clean with other plugins (e.g. postcss-nesting).

API

clean([options])

Note that postcss-clean is an asynchronous processor. It cannot be used like this:

var out = postcss([ clean() ]).process(css).css;
console.log(out)

Instead make sure your runner uses the async APIs:

postcss([ clean() ]).process(css).then(function(out) {
    console.log(out.css);
});

options

It simply proxies the clean-css options. See the complete list of options here.

Usage

See the PostCSS documentation for examples for your environment.

Contributing

Pull requests are welcome.

License

MIT © Leonardo Di Donato


Analytics

changelog

1.2.2 (2021-02-07)

Build

CI

Docs

Update

Upgrade

1.2.1 (2021-01-22)

CI

Build

1.1.0 (2017-09-15)

Upgrade

1.0.4 (2017-09-15)

Upgrade

1.0.3 (2017-07-06)

Build

Docs

Fix

Update

Upgrade

1.0.2 (2016-05-05)

Build

Docs

Update

1.0.1 (2016-04-19)

Build

Fix

New

Update

1.0.0 (2016-03-06)

  • Initial release
  • Full support of clean-css functionalities