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

Index replacements fail to occur when using gulp-filter #59

Closed
dietrich-stein opened this issue Mar 25, 2016 · 1 comment
Closed

Index replacements fail to occur when using gulp-filter #59

dietrich-stein opened this issue Mar 25, 2016 · 1 comment

Comments

@dietrich-stein
Copy link

The task shown below fails to replace the not-yet-revved references in my index.html file. Other than that is is working perfectly. I have tried so many different approaches at this point that I'm considering abandoning this package. The only way I can get it to work is to remove my filters and allow it to write all of CSS and JS files to the root path where the index.html file resides. Any ideas?

gulp.task('assets-revision', ['analyze', 'clean', 'assets-fonts', 'assets-other'], function() {
    var jsFilter = plugins.filter('**/*.js', { restore: true });
    var cssFilter = plugins.filter('**/*.css', { restore: true });

    return gulp.src([
        config.build + '/index.html',
        config.build + '/css/**/*.css',
        config.build + '/js/**/*.js'
    ])

    .pipe(plugins.rev())

    .pipe(jsFilter)
    .pipe(gulp.dest(config.build + '/css/'))
    .pipe(jsFilter.restore)

    .pipe(cssFilter)
    .pipe(gulp.dest(config.build + '/js/'))
    .pipe(cssFilter.restore)

    .pipe(plugins.revReplace());
});
@dietrich-stein
Copy link
Author

For anyone searching the closed list my solution was to jump ship over to these:

smysnk/gulp-rev-all
nib-health-funds/gulp-rev-delete-original

That allowed me simplify things considerably:

gulp.task('assets-revision', ['analyze', 'clean', 'assets-fonts', 'assets-other'], function() {
    var revAll = new plugins.revAll({
        dontRenameFile: [
            /^\/index.html/g
        ]
    });

    return gulp.src([
        config.dest + '/**/index.html',
        config.dest + '/css/**/*.css',
        config.dest + '/js/**/*.js'
    ])
        .pipe(revAll.revision())
        .pipe(revdel())
        .pipe(gulp.dest(config.dest + '/'));
});

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

1 participant