0

I'm trying to integrate gulp-rev with browserify. I can't seem to get gulp-useref and gulp-rev-replace to replace the browserified file with the revved file.

So far I just have these tasks for useref and browserify:

gulp.task('html', function() {
  var assets = useref.assets();

  return gulp.src('app/*.html')
    .pipe(assets)
    .pipe(gulpif('*.js', uglify()))
    .pipe(gulpif('*.css', minifyCSS()))
    .pipe(buffer())
    .pipe(rev())
    .pipe(assets.restore())
    .pipe(useref())
    .pipe(revReplace())
    .pipe(gulp.dest('dist'));
});

gulp.task('browserify', ['lint'], function() {
  var bundleStream = browserify('./app/scripts/app.js').bundle();

  return bundleStream
    .pipe(source('bundle.js'))
    .pipe(gulp.dest('dist/static/js'));
});

I simply copied what was in the docs from the packages.

Thanks!

dsdeiz
  • 137
  • 2
  • 10

1 Answers1

0

I have currently an open question on a similar issue - I get the files revved properly, but fail to inject them in the html with gulp-useref. I suspect some foul play with the directories I use in my case, but for now I've chosen to use a different cache-busting scheme:

var cb = Math.random();

....
.pipe($.replace('dist/css/lib.css', 'dist/css/lib.css?cb=' + cb))
....
Community
  • 1
  • 1
st2rseeker
  • 473
  • 1
  • 5
  • 28