D
D
doctorcat2019-01-23 20:18:00
css
doctorcat, 2019-01-23 20:18:00

How to set up browsersync in gulp on a remote server to keep the functionality?

I use browsersync in conjunction with gulp. Gulp tracks changes in css, html files and tells the browser to refresh the page. All this works fine on the local machine. Code below.

gulp.task('browserSync', function() {
    browserSync.init({
        proxy: "test.server",
        port: 8080,
        open: true,
        notify: false
    });

    gulp.watch("www/static/**/*.scss", ["style"]);
    gulp.watch('www/static/common.css').on("change", browserSync.reload);
    gulp.watch('www/local/templates/.default/components/**/*.twig').on("change", browserSync.reload);

});

But now I have a need to work with files remotely and see the results of all changes online in the browser of my machine. As I did not try to understand or configure, finding similar examples is not very successful. Is this even possible? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
grinat, 2019-01-23
@grinat

You need to forward the local port of the galp outside, and then connect (stupidly open it in the browser) to it by ip-address:port-to-which-you-forwarded
Only there are possible different vyzhyzhy on his part, they say you have the wrong host, or the origin is incorrect, this can be solved by passing through the nginx proxy and changing the headers that he or the browser does not like, for those that do.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question