Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stackcss/css-extract
Extract CSS from a browserify bundle
https://github.com/stackcss/css-extract
browserify browserify-plugin extract-css
Last synced: about 1 month ago
JSON representation
Extract CSS from a browserify bundle
- Host: GitHub
- URL: https://github.com/stackcss/css-extract
- Owner: stackcss
- License: mit
- Created: 2016-03-06T05:01:44.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-08-06T17:50:05.000Z (over 4 years ago)
- Last Synced: 2024-11-11T18:54:09.224Z (about 2 months ago)
- Topics: browserify, browserify-plugin, extract-css
- Language: JavaScript
- Homepage:
- Size: 28.3 KB
- Stars: 46
- Watchers: 6
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
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