PostCss plugin to minify your CSS with clean-css
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
.gitattributes Release 1.0.1 (#10) Apr 19, 2016
.gitignore Release 1.0.1 (#10) Apr 19, 2016
.npmignore
.travis.yml Build: Also node 7 in the test matrix Jul 5, 2017
CHANGELOG.md New: Version 1.1.0 Sep 15, 2017
LICENSE
README.md
index.m.js
package.json New: Version 1.1.0 Sep 15, 2017
rollup.config.js Build: Destructuring within the configuration file not possible for n… Jul 5, 2017
test.js
yarn.lock

README.md

postcss-clean CI 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