sindresorhus/gulp-rev — pull request #3 by dtinth (2014-01-15 13:41:57+00:00)
Title: Allow updating references to hash-tagged file names.

Right now, this plug in just appends a hash to file names. However, it does not update the files that referenced them.

This pull request added a "context stream" that `gulp-rev` can pipe original and modified file names to it.
This stream is then used to create another stream that replaces the file contents.

I have also added the documentations in the README file.

An Example
----------------

index.html:

```html

Hello world!

```

gulpfile.js:

```javascript
'use strict';

var gulp = require('gulp');
var rev = require('../');

gulp.task('default', function() {
var context = rev.Context();
gulp.src('css/**.css')
.pipe(rev(context))
.pipe(gulp.dest('dist/css'));
gulp.src('index.html')
.pipe(context.replace(/href="css\/(\w+\.css)"/g, 'href="css/{{$1}}"'))
.pipe(gulp.dest('dist'));
});
```

When running `gulp`, the first set of commands appends hashes to filenames:

* `print.css` -> `print-07d40ef1.css`
* `test.css` -> `test-c5a746a8.css`

In the second set of command, it uses RegExp to replace "css/test.css" into "css/{{test.css}}",
which is then converted to "css/test-c5a746a8.css".

The resulting `index.html` looks like this:

```html

Hello world!

```

---

This behavior is totally backwards compatible—just don't pass a context.