A
A
Arthur2017-08-16 16:17:37
PHP
Arthur, 2017-08-16 16:17:37

How to set up browserSync for the dev version of a php site running through docker?

There is a dev version of the site, the environment is raised via docker,
how to properly configure browserSync in Galp so that it refreshes the page when css changes?
a site with a running docker is available via test.dev
on the docker nginx, php71, mysql, memcash
for static html did this:

gulp.task('browser-sync', function() { // Создаем таск browser-sync
    browserSync({ // Выполняем browserSync
        server: { 
            baseDir: 'app'
        },
        notify: false
    });
});

gulp.task('watch', ['browser-sync'], function() {
    gulp.watch('app/**/*.css', browserSync.reload); // Наблюдение за css

but it is not suitable for php, so I began to try other options, the
example below opens the test.dev page as it should, but does not update when it changes
var gulp = require('gulp'), // Подключаем Gulp
      browserSync = require('browser-sync'), 
      connectPHP = require('gulp-connect-php'); 

gulp.task('php', function () {
    connectPHP.server({base: './', keepalive: true, hostname: 'http://test.dev', port: 80, open: false});
});

gulp.task('browser-sync', function () { // Создаем таск browser-sync
    browserSync({ // 
        proxy: "http://test.dev",
        port: 80,
        notify: true,
    });
});
gulp.task('watch', ['browser-sync'], function () {
    gulp.watch('web/**/*.css', browserSync.reload); // Наблюдение за css
});

what could be the problem? how to make the correct setting for auto-update?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question