Browser-sync: Browser command line arguments.

Created on 24 Mar 2016  路  2Comments  路  Source: BrowserSync/browser-sync

I need to run browser with specific command line:

E.g.
chrome.exe --remote-debugging-port=9222

Please specify which version of Browsersync, node and npm you're running

  • Browsersync [latest]
  • Node [x]
  • Npm [x]

    Affected platforms

  • [ ] linux

  • [x] windows
  • [ ] OS X
  • [ ] freebsd
  • [ ] solaris
  • [ ] other _(please specify which)_

    Browsersync use-case

  • [ ] API

  • [x] Gulp
  • [ ] Grunt
  • [ ] CLI
  bs.init({
    browser: 'chrome --remote-debugging-port=9222',
    files: 'client/**',
    ghostMode: false,
    proxy: 'http://localhost:3000'
  });

This just opens my default browser (Firefox).

Most helpful comment

This is out of scope for Browsersync core and can be easily added with something like this instead

bs.init({
    open: false,
    files: 'client/**',
    ghostMode: false,
    proxy: 'http://localhost:3000'
}, function (err, bs) {
    require('opn')(bs.options.getIn(['urls', 'local']), {app: ['google chrome', '--incognito']});
});

All 2 comments

This is out of scope for Browsersync core and can be easily added with something like this instead

bs.init({
    open: false,
    files: 'client/**',
    ghostMode: false,
    proxy: 'http://localhost:3000'
}, function (err, bs) {
    require('opn')(bs.options.getIn(['urls', 'local']), {app: ['google chrome', '--incognito']});
});

Great hint, but for me it was given:

[Browsersync] Watching files... (node:25781) UnhandledPromiseRejectionWarning: Error: spawn google chrome ENOENT at _errnoException (util.js:1022:11)

Fixed using 'google-chrome' instead of 'google chrome' though ...

require('opn')(bs.options.getIn(['urls', 'local']), {app: ['google-chrome', '--incognito']});

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ngryman picture ngryman  路  3Comments

Hurtak picture Hurtak  路  3Comments

w88975 picture w88975  路  3Comments

kraf picture kraf  路  3Comments

Zver64 picture Zver64  路  3Comments