# clean-css-promise

> clean-css with the default Promise interface and some improvements

Latest version **3.0.0** (published 2019-06-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install clean-css-promise
pnpm add clean-css-promise
yarn add clean-css-promise
bun add clean-css-promise
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2019-06-10 |
| First published | 2015-10-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Watanabe Shinnosuke |
| Maintainers | shinnn |
| Keywords | css, clean-css, cleancss, style, styles, stylesheet, minifier, minification, compress, optimization, optimize, optimizer, promise, promises, then, thenable |

## Links

- npm: https://www.npmjs.com/package/clean-css-promise
- Repository: https://github.com/shinnn/clean-css-promise
- Homepage: https://github.com/shinnn/clean-css-promise#readme
- Issues: https://github.com/shinnn/clean-css-promise/issues
- npm.io page: https://npm.io/package/clean-css-promise

## Dependencies (3)

- [clean-css](https://npm.io/package/clean-css.md) ^4.2.1
- [is-plain-obj](https://npm.io/package/is-plain-obj.md) ^2.0.0
- [inspect-with-kind](https://npm.io/package/inspect-with-kind.md) ^1.0.5

## 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

- 3.0.0 (latest) — 2019-06-10
- 3.0.0-2 (next) — 2018-11-09
- 3.0.0-1 — 2018-11-09
- 3.0.0-0 — 2018-11-09
- 2.1.0 — 2017-12-11
- 2.0.1 — 2017-02-06
- 2.0.0 — 2017-02-02
- 1.0.1 — 2015-12-05
- 0.1.1 — 2015-12-04
- 0.1.0 — 2015-12-03
- 0.0.0 — 2015-12-03
- 1.0.0 — 2015-10-06
- 0.0.1 — 2015-10-06

## README

# clean-css-promise

[![npm version](https://img.shields.io/npm/v/clean-css-promise.svg)](https://www.npmjs.com/package/clean-css-promise)
[![Github Actions](https://action-badges.now.sh/shinnn/clean-css-promise)](https://wdp9fww0r9.execute-api.us-west-2.amazonaws.com/production/results/shinnn/clean-css-promise)
[![codecov](https://codecov.io/gh/shinnn/clean-css-promise/branch/master/graph/badge.svg)](https://codecov.io/gh/shinnn/clean-css-promise)

[clean-css](https://github.com/jakubpawlowicz/clean-css) with the default [Promise](https://developer.mozilla.org/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Promise) interface and some improvements

```javascript
const CleanCssPromise = require('clean-css-promise');

(async () => {
  const {styles} = await new CleanCssPromise().minify(`
p {
  color: #ff0000;
}

b {
  /* nothing */
}
`); //=> 'p{color:red}'
})();
```

## Installation

[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).

```
npm install clean-css-promise
```

## API

```javascript
const CleanCssPromise = require('clean-css-promise');
```

### class CleanCssPromise([*options*])

*options*: `Object` ([clean-css constructor options](https://github.com/jakubpawlowicz/clean-css#constructor-options))  

Almost the same the original `clean-css`, except for:

* [`returnPromise` option](https://github.com/jakubpawlowicz/clean-css#promise-interface) is enabled by default, and cannot be disabled.
* [*onRejected*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then#Parameters) function receives an `Error` instead of an `Array`.
* All problems that clean-css considers as *warnings*, for example broken CSS syntax, are regarded as *errors*.

```javascript
const CleanCssPromise = require('clean-css-promise');

new CleanCssPromise({})
.minify('@import url(/foo);}')
.catch(err => {
  err.message;
  /*=> `2 errors found while optimizing CSS with clean-css:
  1. Ignoring local @import of "/foo" as resource is missing.
  2. Invalid character(s) '?' at 1:18. Ignoring.

clean-css dangerously ignores these errors but clean-css-promise doesn't, because it's much more reasonable to update the CSS to fix all problems than to pretend that you didn't see the errors.` */
});
```

## License

[ISC License](./LICENSE) © 2017 - 2019 Watanabe Shinnosuke

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