Gulp task to generate an md5 mapped directory of assets.
Given filesystem input:
├── img
│ └── rind.png
├── js
│ └── hello.js
└── txt
└── sample.txt
Produces:
├── hash.json
├── img
│ └── rind.d6bc63f.png
├── js
│ └── hello.d81ffe3.js
└── txt
└── sample.6f5902a.txt
Where hash.json
will contain the mapping from original filename to md5'd version:
{
"/img/rind.png": "/img/rind.d6bc63f.png",
"/js/hello.js": "/js/hello.d81ffe3.js",
"/txt/sample.txt": "/txt/sample.6f5902a.txt"
}
var gulp = require('gulp');
var hash = require('rind-hash-gulp');
/*
var opts = {
cwd: // directory to glob
output: // output directory
hash: // path and filename for hash.json
mapping: // if set to `dev` then hash.json will point to original files
copy: // glob pattern of files to just copy instead of md5'ing
symbol: // separator between file path and md5, defaults to '.'
verbose: // output process
};
*/
gulp.task('hash', hash(gulp, opts));