# gulp-rev-update

> Update occurences of filenames which have been renamed by gulp-rev

Latest version **1.0.2** (published 2017-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-rev-update
pnpm add gulp-rev-update
yarn add gulp-rev-update
bun add gulp-rev-update
```

## 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-09-01 |
| First published | 2017-02-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 15 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jacek Świtoń |
| Maintainers | jswiton |
| Keywords | gulpplugin, rev, revision, version, hash, optimize, version, versioning, update, static, asset |

## Links

- npm: https://www.npmjs.com/package/gulp-rev-update
- Repository: https://github.com/jswiton/gulp-rev-update
- Homepage: https://github.com/jswiton/gulp-rev-update#readme
- Issues: https://github.com/jswiton/gulp-rev-update/issues
- npm.io page: https://npm.io/package/gulp-rev-update

## Dependencies (15)

- [fs](https://npm.io/package/fs.md) 0.0.1-security
- [path](https://npm.io/package/path.md) ^0.12.7
- [assert](https://npm.io/package/assert.md) ^1.4.1
- [eslint](https://npm.io/package/eslint.md) ^3.15.0
- [gulp-rev](https://npm.io/package/gulp-rev.md) ^7.1.2
- [rev-hash](https://npm.io/package/rev-hash.md) ^1.0.0
- [rev-path](https://npm.io/package/rev-path.md) ^1.0.0
- [through2](https://npm.io/package/through2.md) ^2.0.3
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.8
- [sort-keys](https://npm.io/package/sort-keys.md) ^1.0.0
- [vinyl-file](https://npm.io/package/vinyl-file.md) ^2.0.0
- [gulp-filter](https://npm.io/package/gulp-filter.md) ^5.0.0
- [modify-filename](https://npm.io/package/modify-filename.md) ^1.1.0
- [eslint-plugin-import](https://npm.io/package/eslint-plugin-import.md) ^2.2.0
- [eslint-config-airbnb-base](https://npm.io/package/eslint-config-airbnb-base.md) ^10.0.1

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2017-09-01
- 1.0.1 — 2017-02-18

## README

[gulp](https://github.com/wearefractal/gulp)-rev-update [![Build Status](https://travis-ci.org/jswiton/gulp-rev-update.svg?branch=master)](https://travis-ci.org/jswiton/gulp-rev-update)
================
> Update occurences of filenames which have been renamed by gulp-rev
> This plugin using `rev-manifest.json` file generated by gulp-rev

## Install
```bash
$ npm install --save-dev gulp-rev-update
```

## Usage
```js
const rev = require('gulp-rev');
const revUpdate = require('gulp-rev-update');

gulp.task('rev', ['build:css', 'dist:js'], function(){
  return gulp.src(['build/**/*.css', 'build/**/*.js'])
    .pipe(rev())
    .pipe(gulp.dest(gulp.config.distFolder))
    .pipe(rev.manifest())
    .pipe(gulp.dest(gulp.config.distFolder))
})

gulp.task('rev-update', ['rev'], function(){
  const manifestFile = `./${gulp.config.distFolder}/rev-manifest.json`;

  return gulp.src(`${gulp.config.srcFolder}/index.html`)
    .pipe(revUpdate({ manifestFile }))
    .pipe(gulp.dest(gulp.config.distFolder));
});
```

## API

### revUpdate(options)

#### options.replaceInExtensions
Type: `Array`

Default: `['.css', '.html', '.hbs', '.php', '.twig', '.htm']`

Only substitute in new filenames in files of these types.

You can modify it, for example if you want update `xml` files do like below:
```js
const revUpdate = require('gulp-rev-update');

gulp.task('rev-update', ['rev'], function(){
  const manifestFile = `./${gulp.config.distFolder}/rev-manifest.json`;

  return gulp.src(`${gulp.config.srcFolder}/index.html`)
    .pipe(revUpdate({ manifestFile, replaceInExtensions: ['xml'] }))
    .pipe(gulp.dest(gulp.config.distFolder));
});
```

#### options.replaceReved
Type: `boolean`

Default: `true`

Use: `replaceReved: false` when you don't want to update reved filenames.


## Streaming

This plugin does not support streaming. If you have files from a streaming source, such as Browserify, you should use [`gulp-buffer`](https://github.com/jeromew/gulp-buffer) before `gulp-rev-update` in your pipeline:

```js
const gulp = require('gulp');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const buff = require('gulp-buffer');
const revUpdate = require('gulp-rev-update');

gulp.task('rev-update', () =>
	browserify(`${gulp.config.srcFolder}/index.php`)
		.pipe(source('index.php'))
		.pipe(buff())
		.pipe(revUpdate())
		.pipe(gulp.dest(gulp.config.distFolder))
);
```

## License
[MIT](http://opensource.org/licenses/MIT) © [Jacek Świtoń](http://etiam.hekko.pl)

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