I am now trying to generate manifest.json file with gulp-rev. What I need is something like this:
{
"img/image.jpg": "folder/img/image-34c9d558b2.jpg";
}
How do I put that "folder" in path there? I was trying to use gulp-rev-collector but it was not very useful. Could someone give me an example please?
Thanks
What worked for me was using gulp-rename
and then doing something like:
.pipe($.rename({
dirname: 'styles',
}))
.pipe($.rev.manifest('manifest.json', {
cwd: 'build',
merge: true,
}))
However, what ultimately worked for me was using gulp-rev
in combination with gulp-rev-collector
, the latter which replaces the links as per the mappings found in the manifest files.
So something like:
.pipe($.rename({
dirname: 'styles',
}))
.pipe($.rev())
.pipe(gulp.dest('build'))
.pipe(gulp.dest('.tmp/styles'))
.pipe($.rev.manifest())
.pipe(gulp.dest('build/styles'));
And also adding a new rev
task for gulp-rev-collector
// Revision static asset files
gulp.task('rev', () =>
gulp.src(['build/**/rev-manifest.json', 'build/*.html'])
.pipe($.revCollector())
.pipe(gulp.dest('build')),
);