I want to try using gulp and I've made a simple project similar to this example
what I want to do is to serve the project using different port, I've tried to follow this costum-port example
and my gulpfile.js looks like this :
var gulp = require('gulp');
var browserSync = require('browser-sync');
var livereload = require('gulp-livereload');
var reload = browserSync.reload;
// watch files for changes and reload
gulp.task('serve', function() {
livereload.listen(1234);
browserSync({
server: {
baseDir: 'app',
}
});
gulp.watch(['*.html', 'styles/**/*.css', 'scripts/**/*.js'], {cwd: 'app'}, reload);
});
I also try to add port in server :{porrt : 9999, baseDir:'app'}
but the result end up with the default port which is 3000.
Is it possible to change the port? Thanks.
In Sublime Text 3 go to Preferences -> Browse Packages... Open 'Browser Sync' folder and edit the browser property in browser_sync_launch. js file. Save this answer.
How Does BrowserSync Work? BrowserSync starts a small web server. If you're already using a local web server or need to connect to a live website, you can start BrowserSync as a proxy server. It injects small script into every page which communicates with the server via WebSockets.
BrowerSync VSCODE Starts a browserSync Static server with watch mode at :3000 by default. The UI for browsersync is available at :3001 . Right click on the folder from your VSCODE explorer menu. And click on BrowerSync Start .
Use the port
option.
browserSync({
port: 9999,
server: {
baseDir: 'app',
}
});
port
is a direct option of BrowerSync, not a sub-option under server
option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With