2

I am trying to replace the name of two script filenames and a styles file name in my index.html and and using gulp-rev to change the names of updated files with a hash, and gulp-rev-replace to do the actual replacement. I am running into a wall though. Gulp-rev is working great, produces a revised file name with a unique hash, and I also see a rev-manifest.json file. What is not happening is the replacement in the index.html file on build. I've included an example of one of the gulp tasks I am running. I am not sure where I am messing up in the revReplace call. Any help would be greatly appreciated.

gulp.task('backbone.templates', function () {
  // compile partials to JST
  gulp.src(config.backboneTemplates.src)
    .pipe(template())
    .pipe(concat('backbone-templates.js'))
    .pipe(buffer())
    .pipe(rev())
    .pipe(gulp.dest(config.backboneTemplates.dest))
    .pipe(rev.manifest('build/rev-template-manifest.json'))
    .pipe(gulp.dest(''))
    .pipe(gulpif(browserSync.active, browserSync.reload({ stream: true, once: true })));
});

gulp.task('revreplace', ['backbone.templates', 'backbone.scripts'], function(){
  var manifest = gulp.src(config.manifest.dest);

  return gulp.src('app/*.html')
    .pipe(revReplace({manifest: manifest}))
    .pipe(gulp.dest(config.dist.root));
});
Andy Pohl
  • 243
  • 4
  • 14

0 Answers0