gulp-hash icon indicating copy to clipboard operation
gulp-hash copied to clipboard

Map function to allow custom manifest

Open BigFax opened this issue 5 years ago • 0 comments

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.

BigFax avatar Mar 17 '20 18:03 BigFax