Answer the question
In order to leave comments, you need to log in
How to hook up ngrok to browser-sync?
Good day! Can you tell me how to tie ngrok to browser-sync? I use Browser sync in gulp builder. The task is that when you run gulp, ngrok is responsible for tunneling and the server. To be honest, I have absolutely no idea how to end this. It is quite possible that my question is incomplete and will be deleted again due to "too general wording". If not, then I will be very grateful to someone who can help me with this problem.
Answer the question
In order to leave comments, you need to log in
I found a solution)
that's what I did for osx
1) Download the ngrok archive
2) throw the binary into applications and make a symlink
cd /usr/local/bin
# create symlink
ln -s /Applications/ngrok ngrok
.....
var ngrok = require('ngrok'), //замена localtunnel, inspector => http://127.0.0.1:4040
.....
var config = {
server: {
baseDir: "./build"
},
//tunnel: true,
host: 'localhost',
port: 1984,
directoryListing: true,
logPrefix: ''
};
gulp.task('webserver', function () {
//browserSync(config);
browserSync(config, function (err, bs) {
ngrok.connect({
proto: 'http', // http|tcp|tls
addr: bs.options.get('port'), // port or network address
}, function (err, url) {
gutil.log('[ngrok]', ' => ', gutil.colors.magenta.underline(url));
});
});
});
Thank you! Only 2 points
if you run ngrok http 8080 then
you need to specify port 8080 in the galp config.
Plus the line gutil.colors.magenta.underline(url) swears had to be deleted)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question