Root SL
Root SL

Reputation: 69

How to disable browsersync in Aurelia application?

I created an Aurelia application using aurelia-cli. I need to disable the browsersync option and also the notifications generated by it. Like "Connected to browser sync" Like that. Is there any way to do that ?

Upvotes: 1

Views: 979

Answers (3)

Christoph Noe
Christoph Noe

Reputation: 55

You can also disable the ghost mode in aurelia_project/tasks/run.js.

Just add ghostMode: false to the browserSync configuration.

let serve = gulp.series(
  build,
  done => {
    browserSync({
      online: false,
      open: false,
      port: 9000,
      logLevel: 'silent',
      ghostMode: false,
      server: {
        baseDir: ['.'],
        middleware: [historyApiFallback(), function(req, res, next) {
          res.setHeader('Access-Control-Allow-Origin', '*');
          next();
        }]
      }
    }, function(err, bs) {
      let urls = bs.options.get('urls').toJS();
      log(`Application Available At: ${urls.local}`);
      log(`BrowserSync Available At: ${urls.ui}`);
      done();
    });
  }
);

This disables the synchronization of interaction events between browsers. At least for me, this is often the most annoying part.

Upvotes: 0

classicalConditioning
classicalConditioning

Reputation: 655

just as a dev side note:

browsersync options are available at localhost:3001 (unless you changed default port)

there you can do things like turn off mirroring clicks and scrolls in all instances of your locally running app (useful when you would like to open two or more different routes in your local app in multiple tabs/browsers) or monitor history of all routes you have visited in your local app.

Upvotes: 0

LStarky
LStarky

Reputation: 2777

When you build your application for production, it will not include Browser Sync.

Instead of the normal

> au run --watch

You'll use

> au build --env prod

After that, you'll need to serve up your application through a traditional web server. If you've correctly bundled it, you'll only need index.html and your scripts folder.

Upvotes: 2

Related Questions