# vinyl-fs-diff

> run tasks only if src files are changed

Latest version **1.0.2** (published 2017-02-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install vinyl-fs-diff
pnpm add vinyl-fs-diff
yarn add vinyl-fs-diff
bun add vinyl-fs-diff
```

## 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 | 1.0.2 |
| Published | 2017-02-07 |
| First published | 2016-12-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ImHype |
| Maintainers | junesmith |
| Keywords | gulpplugin, file, files, changed, newer, modified, diff |

## Links

- npm: https://www.npmjs.com/package/vinyl-fs-diff
- Repository: https://github.com/imhype/vinyl-fs-diff
- Homepage: https://github.com/imhype/vinyl-fs-diff#readme
- Issues: https://github.com/imhype/vinyl-fs-diff/issues
- npm.io page: https://npm.io/package/vinyl-fs-diff

## Dependencies (3)

- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [through2](https://npm.io/package/through2.md) ^2.0.0
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2017-02-07
- 1.0.1 — 2017-01-01
- 1.0.0 — 2016-12-25

## README

## Vinyl-Fs-Diff

gulp module to stream files only if target files are changed.

## Getting Started

### Install

```
$ npm install vinyl-fs-diff --save-dev
```

### Usage

This task will keep a hash reference of target files and run defined tasks only if files changed.
File hashes will be saved in `.diff/hash.json`. You might like to add `.gulp` to your `.gitignore`.

```javascript
const diff = require('vinyl-fs-diff');

const SRC = 'src';
const DEST = 'dist';

gulp.task('default', () => {
    gulp.src(SRC)
        .pipe(diff())
        .pipe(gulp.dest(DEST));
});
```

## Options

### clear

Type: `bool` Default value: `false`

flush file hashes running with clear option value: `true`

### dest

Type: `string` or `array` Default value: `undefined`

option to filter streaming files. This task will stream only files that match given paths into the gulp stream. If it is undefined, all files will be passed.

### hash

Type: `string` Defualt value: `'hash'`

options to define filename of hash references for multi tasking or multi cache control. files of hash references will be saved as `.diff/[givenName].json`.

## Example

example of building sass.

gulp task watch all of sass src files and stream only `main.sass` and `main-sp.sass` into `sass()` task.

```javascript
const diff = require('vinyl-fs-diff');

gulp.task('default', () => {
    gulp.src('src/sass/**/*.sass')
        .pipe(diff({
            clean: true,
            dest: [
                'src/sass/main.sass',
                'src/sass/main-sp.sass'
            ],
            hash: 'sass'
        }))
        .pipe(sass()),
        .pipe(gulp.dest('dest'));
});
```

## License

The MIT License (MIT)

Copyright 2016~ moshisora

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