# postcss-clean

> PostCSS plugin to minify CSS with clean-css

Latest version **1.2.2** (published 2021-02-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-clean
pnpm add postcss-clean
yarn add postcss-clean
bun add postcss-clean
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2021-02-07 |
| First published | 2016-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=4.0.0 |
| Dependencies | 2 |
| Unpacked size | 18 KB |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 43 |
| Author | Leo Di Donato |
| Maintainers | leodido |
| Keywords | postcss, css, postcss-plugin, clean-css, minifier, minify, minification, optimisation, optimization, optimise, optimize, compress, compression |

## Links

- npm: https://www.npmjs.com/package/postcss-clean
- Repository: https://github.com/leodido/postcss-clean
- Issues: https://github.com/leodido/postcss-clean/issues
- npm.io page: https://npm.io/package/postcss-clean

## Dependencies (2)

- [postcss](https://npm.io/package/postcss.md) ^6.x
- [clean-css](https://npm.io/package/clean-css.md) ^4.x

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 1.2.2 (latest) — 2021-02-07
- 1.2.1 — 2021-01-23
- 1.2.0 — 2021-01-21
- 1.1.0 — 2017-09-15
- 1.0.4 — 2017-09-15
- 1.0.3 — 2017-07-06
- 1.0.2 — 2016-05-05
- 1.0.1 — 2016-04-19
- 1.0.0 — 2016-03-06

## README

# [postcss][postcss]-clean ![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/leodido/postcss-clean/build/master?style=flat-square) [![NPM](https://img.shields.io/npm/v/postcss-clean.svg?style=flat-square)][npm] [![Coveralls branch](https://img.shields.io/coveralls/leodido/postcss-clean/master.svg?style=flat-square)](https://coveralls.io/r/leodido/postcss-clean?branch=master) [![NPM Monthly Downloads](https://img.shields.io/npm/dm/postcss-clean.svg?style=flat-square)][npm]

> PostCss plugin to minify your CSS

Compression will be handled by **[clean-css][clean-css]**, which according to [this benchmark](http://goalsmashers.github.io/css-minification-benchmark) is one of the top (probably the best) libraries for minifying CSS.

## Install

With [npm](https://npmjs.org/package/postcss-clean) do:

```
npm install postcss-clean --save
```

## Example

### Input

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

### Output

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

### Input

```css
:host {
  display: block;
}

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

### Output

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

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

## API

### `clean([options])`

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

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

Instead make sure your runner uses the async APIs:

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

#### options

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

## Usage

See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for examples for your environment.

## Contributing

Pull requests are welcome.

## License

MIT © Leonardo Di Donato

---

[![Analytics](https://ga-beacon.appspot.com/UA-49657176-1/postcss-clean?flat)](https://github.com/igrigorik/ga-beacon)

[clean-css]:       http://github.com/jakubpawlowicz/clean-css
[clean-css-opts]:  https://github.com/jakubpawlowicz/clean-css/tree/3.4#how-to-use-clean-css-api
[ci]:              https://travis-ci.org/leodido/postcss-clean
[deps]:            https://gemnasium.com/leodido/postcss-clean
[postcss]:         https://github.com/postcss/postcss
[postcss-nesting]: https://github.com/jonathantneal/postcss-nesting
[npm]:             https://www.npmjs.com/package/postcss-clean

---
_Source: https://npm.io/package/postcss-clean · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
