Skip to content

Commit 3bf29b2

Browse files
committed
feat(gulp): add file revisioning for images
use `rev.manifest` to record name changes and pass the manifest to `rev.replace` to update the appropriate files
1 parent 3602406 commit 3bf29b2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: app/templates/gulpfile.babel(gulp).js

+10-2
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,8 @@ gulp.task('build', cb => {
464464
gulp.task('clean:dist', () => del([`${paths.dist}/!(.git*|.openshift|Procfile)**`], {dot: true}));
465465

466466
gulp.task('build:client', ['transpile:client', 'styles', 'html'], () => {
467+
var manifest = gulp.src(`${paths.dist}/${clientPath}/assets/rev-manifest.json`);
468+
467469
var appFilter = plugins.filter('**/app.js');
468470
var jsFilter = plugins.filter('**/*.js');
469471
var cssFilter = plugins.filter('**/*.css');
@@ -490,7 +492,7 @@ gulp.task('build:client', ['transpile:client', 'styles', 'html'], () => {
490492
.pipe(htmlBlock)
491493
.pipe(plugins.rev())
492494
.pipe(htmlBlock.restore())
493-
.pipe(plugins.revReplace())<% if(filters.jade) { %>
495+
.pipe(plugins.revReplace({manifest}))<% if(filters.jade) { %>
494496
.pipe(assetsFilter)<% } %>
495497
.pipe(gulp.dest(`${paths.dist}/${clientPath}`));
496498
});
@@ -530,7 +532,13 @@ gulp.task('build:images', () => {
530532
progressive: true,
531533
interlaced: true
532534
}))
533-
.pipe(gulp.dest(`${paths.dist}/${clientPath}/assets/images`));
535+
.pipe(plugins.rev())
536+
.pipe(gulp.dest(`${paths.dist}/${clientPath}/assets/images`))
537+
.pipe(plugins.rev.manifest(`${paths.dist}/${clientPath}/assets/rev-manifest.json`, {
538+
base: `${paths.dist}/${clientPath}/assets`,
539+
merge: true
540+
}))
541+
.pipe(gulp.dest(`${paths.dist}/${clientPath}/assets`));
534542
});
535543

536544
gulp.task('copy:extras', () => {

0 commit comments

Comments
 (0)