Cory Dobson
Cory Dobson

Reputation: 73

Prevent Browsersync from reloading Wordpress wp-admin pages

I'm trying to avoid browsersync from reloading any pages in the backend of wordpress, with URL's that start with 'mydomain.com/wp-admin'. Below is what I've tried, but with no luck. It works perfectly otherwise, but won't prevent reloading pages in the Wordpress dashboard.

My code:

// SASS PROCESSING/CSS MINIMIZING
gulp.task('sass', function () {
    return gulp.src(theme_path+'/sass/**/*.scss')
        .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
        .pipe(gulp.dest(theme_path))
        .pipe(browserSync.stream());
});

// BROWSERSYNC
gulp.task('browser-sync', function() {
    var files = [theme_path+'/*.php', theme_path+'/*.html', 
    theme_path+'/sass/*.scss'];

    browserSync.init(files, {
        proxy: localProxy,
        notify: true,
        snippetOptions: {
            ignorePaths: "wp-admin/**"
        }
    });
});

gulp.task('default', ['sass', 'browser-sync'], function(){
    gulp.watch(theme_path+'/sass/**/*.scss', ['sass']);
}); 

I've tried the following paths in the "ignorePaths" option:

Upvotes: 0

Views: 524

Answers (1)

viande
viande

Reputation: 97

You actually just need to add the website path before the /wp-admin like this :

  server.init({
    proxy: "http://localhost:8888/mywebsite",
    snippetOptions: {
      ignorePaths: "mywebsite/wp-admin/**"
    }
  });

Upvotes: 2

Related Questions