gulp-hash
gulp-hash copied to clipboard
Map function to allow custom manifest
Hi, would be nice to have a function allowing custom manifest. This pull request, allows it.
Example :
return gulp.src([
'./base.css'
])
.pipe(hash({
hashLength: 8,
template: '<%= hash %><%= ext %>'
}))
.pipe(gulp.dest('./dist'))
.pipe(hash.manifest('./data/assets.json', {
map: function (origPath, relative) {
return [origPath, '/css/' + relative];
}
}))
.pipe(gulp.dest('.'));
Will produce :
{"base.css":"/css/65c3ac6b.css"} instead of {"base.css":"65c3ac6b.css"}
I also change the way buffer is created in a second commit, but looks like this commit doesn't pass checks, could remove it if need it.