Running multiple apps and Browsersync
Opened this issue · 1 comments
Hello,
in order to run multiple apps I added some lines in my file gulpfile.js
var browserSync = require("browser-sync").create();
gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: "./"
},
ui: {
port: 8080
}
});
});
Now I have two tries to run BrowserSync when I execute npm run start
The first statement (located in a place unknown to me) halts (this is the one coming by default when you download this boilerplate package) and the second that I can read in the logs, that uses the options passed through gulpfile.js, works and starts node.
Where is this statement located by default in the boilerplate package?
Thank you.
OK, so the issue gets solved by creating a file named bs-config.json
And inside you have for example:
{
"port": 3009,
"files": ["./**/*.{html,htm,css,js}"],
"server": { "baseDir": "./" },
"ui" : {
"port": 3010
}
}
Basically what happens is that Gulp is executed by default by the lite-server.
Therefore, if you call it using Gulp, it gets called twice in the end.
So, in order to run BrowserSync with custom options, you have to insert the options that will override the default ones in bs-config.json.
Hope it will help someone else as well.