How to use browser sync firewall for gulp?

I want to know if someone uses browser synchronization with a stroller, is this possible? How to configure it? I tried to read if there is something on the Internet, but nothing is clear to me. Are there other services for working with files simultaneously on all devices?

+6
source share
1 answer

If your roaming box is working, you should have access to your site through your chosen domain. In this example, let your site load through mysite.local

In your gulpfile.js you will need to configure a proxy, for example:

 // gulpfile.js gulp.task('browser-sync', function() { browserSync.init(["path/to/your/css/*.css", "path/to/your/js/*.js"], // The magic line. Point the proxy to your local domain { proxy: "mysite.local" } ); }); 

Restart gulp if it is already running, and you should see the IP address on the command line:

enter image description here

Pay attention to the port number (in this case :3000 )

Now go to http://mysite.local:3000 - Pay attention to the port! You must add the port that appears on the command line. BrowserSync will connect!

Note. If this does not work, the cache may be your problem. Try adding a random query string to the end of your URL to get around the caching issue. Example: http://mysite.local:3000/?t=1

0
source

Source: https://habr.com/ru/post/972975/


All Articles