-
-
Save ahmadawais/a0509dd179ec511152c5 to your computer and use it in GitHub Desktop.
// first run npm install ngrok - then put var ngrok = require('ngrok'); at the top of your gulpfile | |
var ngrok = require('ngrok'); | |
var browserSync = require('browser-sync') | |
browserSync({ | |
server: "./app" | |
}, function (err, bs) { | |
ngrok.connect(bs.options.get('port'), function (err, url) { | |
// https://757c1652.ngrok.com -> 127.0.0.1:8080 | |
}); | |
}); |
"bs" means when the variable you declared when you "required" browser-sync. Example:
var bs = require('browser-sync');
I prefer this because it's easier to understand.
var browserSync = require('browser-sync');
What is meen "bs"?
bs in function (err, bs) means the BrowserSync instance created.
Hi, I tried to use you script to proxy a local project with Ngrok but nothing happens...
This is what I added to my gulpfile.js
var ngrok = require('ngrok'); var browserSync = require('browser-sync') browserSync({ proxy: '10.0.0.87:8888/test-site/', port: 8888, open: false, notify: false }, function (err, browserSync) { ngrok.connect(browserSync.options.get('port'), function (err, url) { // https://757c1652.ngrok.com -> 127.0.0.1:8080 }); });
This is my MAMP's internal network url: 10.0.0.87:8888/testsite/
But this is what my Gulp says:
`
Local: http://localhost:8890/test-site/
External: http://10.0.0.87:8890/test-site/
UI: http://localhost:3001
UIExternal: http://localhost:3001
`
Internally works perfect between my devices, but when I try to see it outside my home lan I just can't. What can I do?
Thanks in advance.
What is meen "bs"?