# css-extract

> Extract CSS from a browserify bundle

Latest version **2.0.0** (published 2020-08-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install css-extract
pnpm add css-extract
yarn add css-extract
bun add css-extract
```

## 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 | 2020-08-06 |
| First published | 2016-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ahdinosaur, bret, goto-bus-stop, hughsk, jongacnik, yoshuawuyts, zhouhancheng |
| Keywords | css, extract, browserify, plugin, transform, sheetify, css-modules |

## Links

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

## Dependencies (5)

- [bl](https://npm.io/package/bl.md) ^4.0.2
- [defined](https://npm.io/package/defined.md) ^1.0.0
- [through2](https://npm.io/package/through2.md) ^4.0.2
- [from2-string](https://npm.io/package/from2-string.md) ^1.1.0
- [static-module](https://npm.io/package/static-module.md) ^3.0.0

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

- 2.0.0 (latest) — 2020-08-06
- 1.3.1 — 2020-08-06
- 1.3.0 — 2018-03-02
- 1.2.0 — 2016-11-16
- 1.1.3 — 2016-10-03
- 1.1.2 — 2016-08-15
- 1.1.1 — 2016-07-29
- 1.1.0 — 2016-03-27
- 1.0.4 — 2016-03-25
- 1.0.0 — 2016-03-06

## README

# css-extract [![stability][0]][1]
[![npm version][2]][3] [![build status][4]][5] [![test coverage][6]][7]
[![downloads][8]][9] [![js-standard-style][10]][11]

Looks up `require('insert-css')` calls to extract CSS from a browserify bundle
to a file. Useful with `sheetify` or any other package / transform that uses
`insert-css`.

## Command line
```sh
$ browserify -t sheetify/transform -p [ css-extract -o bundle.css ] index.js \
  -o bundle.js
```

## JS api
```js
const browserify = require('browserify')

browserify()
  .transform('sheetify/transform')
  .plugin('css-extract', { out: 'bundle.css' })
  .bundle()
```

```js
const browserify = require('browserify')

browserify()
  .transform('sheetify/transform')
  .plugin('css-extract', { out: createWriteStream })
  .bundle()

function createWriteStream () {
  return process.stdout
}
```

## Options
- `-o` / `--out`: specify an outfile, defaults to `bundle.css`. Can also be a
  function that returns a writable stream from the JavaScript API.

## Installation
```sh
$ npm install css-extract
```

## See Also
- [sheetify](https://github.com/stackcss/sheetify)
- [insert-css](https://github.com/substack/insert-css)

## License
[MIT](https://tldrlegal.com/license/mit-license)

[0]: https://img.shields.io/badge/stability-stable-green.svg?style=flat-square
[1]: https://nodejs.org/api/documentation.html#documentation_stability_index
[2]: https://img.shields.io/npm/v/css-extract.svg?style=flat-square
[3]: https://npmjs.org/package/css-extract
[4]: https://img.shields.io/travis/stackcss/css-extract/master.svg?style=flat-square
[5]: https://travis-ci.org/stackcss/css-extract
[6]: https://img.shields.io/codecov/c/github/stackcss/css-extract/master.svg?style=flat-square
[7]: https://codecov.io/github/stackcss/css-extract
[8]: http://img.shields.io/npm/dm/css-extract.svg?style=flat-square
[9]: https://npmjs.org/package/css-extract
[10]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[11]: https://github.com/feross/standard

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