Skip to content

Commit ad9c020

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 2c32f9a commit ad9c020

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
@@ -456,6 +456,8 @@ gulp.task('build', cb => {
456456
gulp.task('clean:dist', () => del([`${paths.dist}/!(.git*|.openshift|Procfile)**`], {dot: true}));
457457

458458
gulp.task('build:client', ['transpile:client', 'styles', 'html'], () => {
459+
var manifest = gulp.src(`${paths.dist}/${clientPath}/assets/rev-manifest.json`);
460+
459461
var appFilter = plugins.filter('**/app.js');
460462
var jsFilter = plugins.filter('**/*.js');
461463
var cssFilter = plugins.filter('**/*.css');
@@ -482,7 +484,7 @@ gulp.task('build:client', ['transpile:client', 'styles', 'html'], () => {
482484
.pipe(htmlBlock)
483485
.pipe(plugins.rev())
484486
.pipe(htmlBlock.restore())
485-
.pipe(plugins.revReplace())<% if(filters.jade) { %>
487+
.pipe(plugins.revReplace({manifest}))<% if(filters.jade) { %>
486488
.pipe(assetsFilter)<% } %>
487489
.pipe(gulp.dest(`${paths.dist}/${clientPath}`));
488490
});
@@ -522,7 +524,13 @@ gulp.task('build:images', () => {
522524
progressive: true,
523525
interlaced: true
524526
}))
525-
.pipe(gulp.dest(`${paths.dist}/${clientPath}/assets/images`));
527+
.pipe(plugins.rev())
528+
.pipe(gulp.dest(`${paths.dist}/${clientPath}/assets/images`))
529+
.pipe(plugins.rev.manifest(`${paths.dist}/${clientPath}/assets/rev-manifest.json`, {
530+
base: `${paths.dist}/${clientPath}/assets`,
531+
merge: true
532+
}))
533+
.pipe(gulp.dest(`${paths.dist}/${clientPath}/assets`));
526534
});
527535

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

0 commit comments

Comments
 (0)