0

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:

  • ./wp-admin/**
  • ./wp-admin/**/*
  • wp-admin/**/*
  • wp-admin/*.php
  • ./wp-admin/*.php
  • ./wp-admin/**/*.php
  • wp-admin/**/*.php
Cory Dobson
  • 63
  • 1
  • 9

1 Answers1

2

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/**"
    }
  });
viande
  • 77
  • 2
  • 10