# gulp-clone

> Clone files in memory in a gulp stream

Latest version **2.0.1** (published 2018-01-16) · 0 weekly downloads

## Install

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

## 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.1 |
| Published | 2018-01-16 |
| First published | 2014-02-13 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 38 |
| Author | Mario Casciaro |
| Maintainers | mariocasciaro |
| Keywords | gulpplugin, clone |

## Links

- npm: https://www.npmjs.com/package/gulp-clone
- Repository: https://github.com/mariocasciaro/gulp-clone
- Issues: https://github.com/mariocasciaro/gulp-clone/issues
- npm.io page: https://npm.io/package/gulp-clone

## Dependencies (2)

- [through2](https://npm.io/package/through2.md) ^2.0.3
- [plugin-error](https://npm.io/package/plugin-error.md) ^0.1.2

## Recent versions

- 2.0.1 (latest) — 2018-01-16
- 1.1.4 (1.x) — 2018-01-16
- 1.1.3 — 2018-01-15
- 2.0.0 — 2018-01-15
- 1.1.2 — 2018-01-15
- 1.1.1 — 2018-01-02
- 1.1.0 — 2018-01-02
- 1.0.0 — 2014-04-06
- 0.1.0 — 2014-02-13

## README

# [gulp](https://github.com/wearefractal/gulp)-clone [![Build Status](https://secure.travis-ci.org/mariocasciaro/gulp-clone.png?branch=master)](https://travis-ci.org/mariocasciaro/gulp-clone) [![NPM version](https://badge.fury.io/js/gulp-clone.png)](http://badge.fury.io/js/gulp-clone) [![Dependency Status](https://gemnasium.com/mariocasciaro/gulp-clone.png)](https://gemnasium.com/mariocasciaro/gulp-clone)

> Duplicate files in memory.

## Install

Install with [npm](https://npmjs.org/package/gulp-clone).

```
npm install --save-dev gulp-clone
```

## Changelog
* 2.0.0: **Possible Breaking change** - The dependency from gutil has been dropped, this has been reported to cause a breaking change in some circumstances. Please continue to use the 1.0 branch if that would cause problems in your setup.
* 1.0.0: **Breaking change** - There is a new operating mode, as explained in the 1st example. The old
 operating mode is still available under the `clone.sink()` property.

## Example

gulp-clone is useful in all those situations where you perform a destructive operation on your files (as for example concat) and you want to keep your original files for further processing or saving.

```js
var gulp = require('gulp');
var concat = require('gulp-concat');
var clone = require('gulp-clone');
var es = require('event-stream');

gulp.task('default', function () {
    var scripts = gulp.src('assets/**/*.js');

    var bundle = scripts.pipe(clone())
      .pipe(concat('bundle.js'));

    // Merge the streams together, then write them to the out folder
    return es.merge(scripts, bundle).pipe(gulp.dest('out'));
});
```

##Example - Bypass mode

```js
var gulp = require('gulp');
var concat = require('gulp-concat');
var clone = require('gulp-clone');

var cloneSink = clone.sink();

gulp.task('default', function () {
  gulp.src('assets/**/*.js')
    .pipe(cloneSink)                //<- clone objects streaming through this point
    .pipe(concat("bundle.js"))
    .pipe(cloneSink.tap())          //<- output cloned objects + bundle.js
    .pipe(gulp.dest('out/'));       //<- saves bundle.js + original files in one pass
});
```

## License

[MIT](http://en.wikipedia.org/wiki/MIT_License) @ Mario Casciaro

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