Skip to content

Commit

Permalink
feat(gulp): add file revisioning for images
Browse files Browse the repository at this point in the history
use `rev.manifest` to record name changes and pass the manifest to
`rev.replace` to update the appropriate files
  • Loading branch information
david-mohr committed Dec 20, 2015
1 parent 3602406 commit 3bf29b2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/templates/gulpfile.babel(gulp).js
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ gulp.task('build', cb => {
gulp.task('clean:dist', () => del([`${paths.dist}/!(.git*|.openshift|Procfile)**`], {dot: true}));

gulp.task('build:client', ['transpile:client', 'styles', 'html'], () => {
var manifest = gulp.src(`${paths.dist}/${clientPath}/assets/rev-manifest.json`);

var appFilter = plugins.filter('**/app.js');
var jsFilter = plugins.filter('**/*.js');
var cssFilter = plugins.filter('**/*.css');
Expand All @@ -490,7 +492,7 @@ gulp.task('build:client', ['transpile:client', 'styles', 'html'], () => {
.pipe(htmlBlock)
.pipe(plugins.rev())
.pipe(htmlBlock.restore())
.pipe(plugins.revReplace())<% if(filters.jade) { %>
.pipe(plugins.revReplace({manifest}))<% if(filters.jade) { %>
.pipe(assetsFilter)<% } %>
.pipe(gulp.dest(`${paths.dist}/${clientPath}`));
});
Expand Down Expand Up @@ -530,7 +532,13 @@ gulp.task('build:images', () => {
progressive: true,
interlaced: true
}))
.pipe(gulp.dest(`${paths.dist}/${clientPath}/assets/images`));
.pipe(plugins.rev())
.pipe(gulp.dest(`${paths.dist}/${clientPath}/assets/images`))
.pipe(plugins.rev.manifest(`${paths.dist}/${clientPath}/assets/rev-manifest.json`, {
base: `${paths.dist}/${clientPath}/assets`,
merge: true
}))
.pipe(gulp.dest(`${paths.dist}/${clientPath}/assets`));
});

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

0 comments on commit 3bf29b2

Please sign in to comment.