condenseify
Version:
Browserify transform to remove unwanted blank lines from your code
60 lines (38 loc) • 1.78 kB
Markdown
# condenseify
[](http://browsenpm.org/package/condenseify)[](https://travis-ci.org/primus/condenseify)[](https://david-dm.org/primus/condenseify)[](https://coveralls.io/r/primus/condenseify?branch=master)[](https://webchat.freenode.net/?channels=primus)
This module for [Browserify](http://browserify.org/) will transform your js
files condensing multiple blank (empty) lines into a single blank line. By
default non empty lines containing only white spaces will be removed.
## Install
```
npm install --save condenseify
```
## Usage
### Command Line
```sh
browserify main.js -t condenseify > bundle.js
```
### API
Register the [transform](https://github.com/substack/node-browserify#btransformtr-opts).
```js
'use strict';
var condenseify = require('condenseify')
, browserify = require('browserify')
, fs = require('fs');
var b = browserify('main.js');
b.transform(condenseify);
b.bundle().pipe(fs.createWriteStream('bundle.js'));
```
### Options
If you want to keep the blank (non empty) lines you can use the `keep-non-empty`
option. Reusing the examples above, this translates into:
```sh
browserify main.js -t [ condenseify --keep-non-empty ] > bundle.js
```
for the command line and
```js
b.transform(condenseify, { 'keep-non-empty': true });
```
for the API.
## License
[MIT](LICENSE)