jamesknelson / gulp-rev-replace

Rewrite occurences of filenames which have been renamed by gulp-rev
MIT License
388 stars 62 forks source link

exclude index.html naming #53

Closed andresmijares closed 7 years ago

andresmijares commented 8 years ago

I'm trying to exclude my index.html out of the version renaming, meaning, it becomes index-12ljn123j1n23.html, I need to remain as index.html

Any options to handle this?

mgw854 commented 8 years ago

@andresmijares, this seems like something you should be taking care of before revving the file--in your gulp stream, simply exclude your index.html page:

gulp.src(["src/**/*.html", "!src/index.html"])

Source globs are processed from left to right, so make sure you include the html files before excluding them, or else they will still appear.

lakshmankotipalli commented 8 years ago

Hello @mgw854 , I am trying to file-rev my files, but I don't want to filerev index.html which is directly inside my app folder, the file structure looks something like below :

projectFolder

styles/ assets/ templates/ index.html which means index.html is directly inside the folder and there are some html files inside templates folder. As I don't want to change the file name of index,html I am doing gulp.src(['projectFolder/*/', '!projectFolder/index.html']). But now index.html is missing from my builds folder. Please help.

mgw854 commented 8 years ago

@lakshmankotipalli that's because you didn't include it in your sources! If you're going to exclude it from your sources that go through the rev pipeline (which you should), you'll need to make sure you have an additional step to include the index.html file in your output directory.

lakshmankotipalli commented 8 years ago

Thanks for the help! :)

senyaak commented 4 years ago

Just in case if someone run into the same issue I did. When you have to long pipe sequence - you can use gulp-filer to exclude index.html inside it and then include again.

  // ...
  const indexFilter = $.filter("!**/index.html");
  // ...  gulp src ....
    .pipe(indexFilter)
    .pipe(rev())
    .pipe(indexFilter.restore())