# gulp-derequire

> A Gulp plugin to apply derequire to target Buffer/Stream

Latest version **3.0.0** (published 2020-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-derequire
pnpm add gulp-derequire
yarn add gulp-derequire
bun add gulp-derequire
```

## 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 | 2020-04-15 |
| First published | 2014-07-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 8.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Takuto Wada |
| Maintainers | twada |
| Keywords | derequire, gulpplugin |

## Links

- npm: https://www.npmjs.com/package/gulp-derequire
- Repository: https://github.com/twada/gulp-derequire
- Homepage: http://github.com/twada/gulp-derequire
- Issues: https://github.com/twada/gulp-derequire/issues
- npm.io page: https://npm.io/package/gulp-derequire

## Dependencies (4)

- [through2](https://npm.io/package/through2.md) ^3.0.0
- [derequire](https://npm.io/package/derequire.md) ^2.0.0
- [plugin-error](https://npm.io/package/plugin-error.md) ^1.0.0
- [bufferstreams](https://npm.io/package/bufferstreams.md) ^3.0.0

## Recent versions

- 3.0.0 (latest) — 2020-04-15
- 2.1.1 — 2020-04-14
- 2.1.0 — 2015-03-09
- 2.0.0 — 2014-09-16
- 1.1.0 — 2014-09-12
- 1.0.0 — 2014-08-26
- 0.3.1 — 2014-08-10
- 0.3.0 — 2014-07-26
- 0.2.1 — 2014-07-26
- 0.2.0 — 2014-07-26
- 0.1.1 — 2014-07-26
- 0.1.0 — 2014-07-26

## README

# gulp-derequire

[![Build Status][travis-image]][travis-url]
[![NPM version][npm-image]][npm-url]
[![Code Style][style-image]][style-url]
[![License][license-image]][license-url]


> A [gulp](https://github.com/gulpjs/gulp) plugin for [derequire](https://github.com/calvinmetcalf/derequire).


## Description
`gulp-derequire` is a gulp plugin to apply [derequire](https://github.com/calvinmetcalf/derequire) to target Buffer/Stream. It's useful when you are building standalone module using [browserify](http://browserify.org/) with gulp.


## Usage

First, install `gulp-derequire` as a development dependency:

```shell
npm install --save-dev gulp-derequire
```

Then, add it to your `gulpfile.js`:

```javascript
const derequire = require('gulp-derequire');
const browserify = require('browserify');
const source = require('vinyl-source-stream');

gulp.task('build', () => {
    const bundleStream = browserify({entries: './index.js', standalone: 'yourModule'}).bundle();
    return bundleStream
        .pipe(source('yourModule.js'))
        .pipe(derequire())
        .pipe(gulp.dest('./build'));
});
```

## API

### derequire(parameters)

__Note:__ parameters are passed verbatim to derequire so see [its readme](https://github.com/calvinmetcalf/derequire) for options

#### customization example

to change both require and define

```javascript
const derequire = require('gulp-derequire');
const browserify = require('browserify');
const source = require('vinyl-source-stream');

gulp.task('build', () => {
    const bundleStream = browserify({entries: './index.js', standalone: 'yourModule'}).bundle();
    return bundleStream
        .pipe(source('yourModule.js'))
        .pipe(derequire([
            {
                from: 'require',
                to: '_dereq_'
            },
            {
                from: 'define',
                to: '_defi_'
            }
        ]))
        .pipe(gulp.dest('./build'));
});
```


## Author

* [Takuto Wada](https://github.com/twada)


## Support Policy

Supports Node under maintenance. In other words, we stop supporting old Node versions when [their maintenance ends](https://github.com/nodejs/Release). Any other environments are not supported officially (means that we do not test against them on CI service).


## License

Licensed under the [MIT](https://github.com/twada/gulp-derequire/blob/master/MIT-LICENSE) license.


[npm-url]: https://npmjs.org/package/gulp-derequire
[npm-image]: https://badge.fury.io/js/gulp-derequire.svg

[travis-url]: https://travis-ci.org/twada/gulp-derequire
[travis-image]: https://secure.travis-ci.org/twada/gulp-derequire.svg?branch=master

[license-url]: https://github.com/twada/gulp-derequire/blob/master/MIT-LICENSE
[license-image]: https://img.shields.io/badge/license-MIT-brightgreen.svg

[style-url]: https://github.com/Flet/semistandard
[style-image]: https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg

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