Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running multiple apps and Browsersync #21

Open
Deviad opened this issue Apr 13, 2016 · 1 comment
Open

Running multiple apps and Browsersync #21

Deviad opened this issue Apr 13, 2016 · 1 comment

Comments

@Deviad
Copy link

Deviad commented Apr 13, 2016

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.

@Deviad
Copy link
Author

Deviad commented Apr 13, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant