gulp-custom-rev
Static asset revisioning by appending content hash to filenames
unicorn.css
→unicorn-098f6bcd.css
Make sure to set the files to never expire for this to have an effect.
Install
$ npm install --save-dev gulp-custom-rev
Usage
var gulp = ;var rev = ; gulp;
Options are intentionally missing as the default should work in most cases.
Original path
Original file paths are stored at file.revOrigPath
. This could come in handy for things like rewriting references to the assets.
Asset hash
The hash of each rev'd file is stored at file.revHash
. You can use this for customizing the file renaming, or for building different manifest formats.
Asset manifest
var gulp = ;var rev = ; gulp;
An asset manifest, mapping the original paths to the revisioned paths, will be written to build/assets/rev-manifest.json
:
By default, rev-manifest.json
will be replaced as a whole. For modifications, add rev-manifest.json
as a gulp source:
var gulp = ;var rev = ; gulp;
You can optionally call rev.manifest({path: 'manifest.json'})
to give it a different path or filename.
Streaming
This plugin does not support streaming. If you have files from a streaming source, such as browserify, you should use gulp-buffer before gulp-rev
in your pipeline:
var gulp = ;var browserify = ;var source = ;var buffer = ;var rev = ; gulp;
Integration
For more info on how to integrate gulp-rev into your app, have a look at the integration guide.
Works with gulp-rev
License
MIT © Sindre Sorhus