Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using rev-replace on the same stream as rev #51

Open
Francisc opened this issue Jan 28, 2016 · 1 comment
Open

Using rev-replace on the same stream as rev #51

Francisc opened this issue Jan 28, 2016 · 1 comment

Comments

@Francisc
Copy link

Hi,

Is it possible to use rev-replace on the same stream as rev without useref?

Doing this fails:

gulp.src(ASSETS_GLOB)
.pipe(rev())
.pipe(revReplace())
.pipe(gulp.dest(DIST_FOLDER));

Because index.html isn't in ASSETS_GLOB.

Adding it to ASSETS_GLOB will make rev-replace revision the HTML file as well, so also bad.

@chaucerbao
Copy link

I ended up achieving this with gulp-filter.

// Filter out HTML files, only assets are passed through
const assetFilter = filter(['**', '!**/*.html'], { restore: true });

gulp.src('**')             // Grab everything
.pipe(assetFilter)         // Filter out HTML files
.pipe(rev())               // gulp-rev
.pipe(assetFilter.restore) // Undo the filter, so we have everything again
.pipe(revReplace())        // Replace filenames
.pipe(gulp.dest(DIST_FOLDER));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants