Giter Club home page Giter Club logo

Comments (1)

andreasgrimm avatar andreasgrimm commented on June 17, 2024

@johnpapa doesn't that line:

.pipe(gulp.dest(pkg.paths.stage)) // write the index.html file changes

... write out all the files in the (at that very moment unfiltered) stream instead of only index.html .. unnecessarily writing over the files already written by

.pipe(gulp.dest(pkg.paths.stage)) // write the rev files

... which gets executed at an earlier point of time in your pipe?

Applying some of your lessons from the pluralsight gulp.js course, I currently got kinda stuck with a similar issue:

gulp.task( 'rev', function () {
  var filesToRevision = [
    config.frontend + config.jsBuildMainFile,
    config.frontend + config.jsBuildLibFile,
    config.frontend + config.stylesBuildFile
  ];
  var filesToRevisionFilter = $.filter([
    config.jsBuildMainFile,
    config.jsBuildLibFile,
    config.stylesBuildFile
  ]);
  var filesToReplaceWithin = [
    config.frontend + config.htmlBuildFile,
    config.frontend + 'bootstrap.js'
  ];
  //var filesToReplaceWithinFilter = $.filter([
  //  config.htmlBuildFile,
  //  'bootstrap.js'
  //]);

  return gulp.src( filesToRevision.concat( filesToReplaceWithin ))
  .pipe( filesToRevisionFilter )
  .pipe( $.rev())
  .pipe( filesToRevisionFilter.restore())
  // TODO: why is gulp-rev-replace not working inside another filter ??
  //.pipe( filesToReplaceWithinFilter )
  .pipe( $.revReplace())
  //.pipe( filesToReplaceWithinFilter.restore())
  .pipe( gulp.dest( config.buildFolder ));
});

Does someone know why rev-replace isn't working inside another filter? The code above is working but rev-replace is substituting in the filenames containing the revision during the second gulp.dest not only in filesToReplaceWithin (e.g. index.html) but in filesToRevision itself as well.

There might be cases when you exactly want to do this. But I guess in general, except the file names, you'd want to have those file's contents untouched.

Any help would be appreciated.

from gulp-rev-replace.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.