# cave

> Remove critical CSS from your stylesheet after inlining it in your pages

Latest version **2.0.0** (published 2014-10-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install cave
pnpm add cave
yarn add cave
bun add cave
```

Provides the command `cave`.

## 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 | 2.0.0 |
| Published | 2014-10-19 |
| First published | 2014-09-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 38 |
| Author | Nicolas Bevacqua |
| Maintainers | bevacqua |

## Links

- npm: https://www.npmjs.com/package/cave
- Repository: https://github.com/bevacqua/cave
- Issues: https://github.com/bevacqua/cave/issues
- npm.io page: https://npm.io/package/cave

## Dependencies (4)

- [css](https://npm.io/package/css.md) ^2.1.0
- [lodash](https://npm.io/package/lodash.md) ^2.4.1
- [minimist](https://npm.io/package/minimist.md) ^1.1.0
- [get-stdin](https://npm.io/package/get-stdin.md) ^3.0.0

## Recent versions

- 2.0.0 (latest) — 2014-10-19
- 1.2.0 — 2014-09-30
- 1.1.2 — 2014-09-18
- 1.1.1 — 2014-09-18
- 1.1.0 — 2014-09-18
- 1.0.0 — 2014-09-17
- 0.0.1 — 2014-09-17

## README

# cave

> Remove critical CSS from your stylesheet after inlining it in your pages

If you don't understand the purpose of this module, refer to [penthouse][1] which extracts critical CSS from a file, but doesn't remove it. Using this tool you can take the styles produced by an extraction tool like [penthouse][1] and actually remove them from your stylesheet.

## Install

```shell
npm install cave --save
```

## API

The `cave` exposes a single function that takes the file path to a stylesheet and a string containing valid CSS you want to remove from the provided stylesheet.

### `cave(stylesheet, options, done)`

The `options` object contains the following properties.

Property | Description
---------|-----------------------------------------------------------------------
`css`    | The CSS rules to remove from the stylesheet. e.g: `a { color: #f00; }`

Cave will produce an AST and remove any matching rules, then the `done` callback will be executed.

## CLI

Cave works well with standard input.

```shell
cat path/to/file | cave <stylesheet> > slim.css
```

You can also pass in the critical CSS file as an option.

```shell
cave --css path/to/file <stylesheet> > slim.css
```

## Tests

Run tests using `npm`.

```shell
npm test
```

## License

MIT

[1]: https://github.com/pocketjoso/penthouse

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