A
A
Alex Shalin2019-01-17 12:49:26
xampp
Alex Shalin, 2019-01-17 12:49:26

BrowserSync doesn't work offline, but XAMPP and WP work, why?

Hello!
Given:

  • laptop
  • Windows 7, firewall disabled, no firewall
  • XAMPP
  • Gulp 4
  • Browsersync
  • Wordpress (or just php files)

I'm working on WordPress sites using the above tools. Test.loc is raised on XAMMP, WP is installed there, I collect all sorts of less- and js-files with Galpom, I observe changes in real time (including on other devices via my local network).
Everything works in the most excellent way, only one BUT: Browsersync refuses to work when I'm not online (there is no Wi-Fi adapter connected on the laptop, I specially cut everything off to check). XAMPP works offline, WordPress does too, but I can't use BS. I have a trip ahead, where, of course, there is not always a network, but you need to work.
I played around with the BS settings (proxy, host, online, ports), but to no avail: the server and site are working, BS is not. Confusingly, I'm guessing that the problem might not even be in the BS, but in the configuration of the XAMPP hosts and ports. I need the help of the mind, in short :) I studied StackOverflow and the docks, I didn’t find anything suitable, there, mostly about static sites and about problems with monitoring php files itself. But I don’t have static and reboot works fine (when there is a network, yes :))
hosts
127.0.0.1 test.loc
xampp
<VirtualHost *:80>
    DocumentRoot "F:/xampp/htdocs/projects/test.loc/www"
    ServerName test.loc
 
    <Directory />
        Options Indexes FollowSymLinks Includes ExecCGI
        DirectoryIndex index.php index.html 
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

var gulp = require('gulp'),
  browserSync = require('browser-sync'),
  reload = browserSync.reload;

var path = {
  watch : {
    php : '*.php'
  }
};

gulp.task('sync', function(done) {
  browserSync({
    proxy: 'dev.loc',
    open : false,
    online : false,
  });
    done();
});

gulp.task('php', function(done){
  reload();
  done();
});

gulp.task('watch', function() {
  gulp.watch(path.watch.php, gulp.parallel('php'));
});

gulp.task('default', gulp.parallel('sync', 'watch'));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2019-01-17
@rPman

https://stackoverflow.com/questions/33306452/brows...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question