Run grunt server with various browsers

bk11425 picture bk11425 · Jul 2, 2013 · Viewed 15.2k times · Source

Is it possible to specify a particular browser (besides the OS' default) in the gruntfile or at the command prompt? E.g. "grunt server firefox" or the like. My default browser is Chrome, but I want to test/develop my site in multiple browsers. I am using GruntJS within Yeoman.

Bryan

Answer

slamborne picture slamborne · Sep 19, 2013

Quick Answer

In Gruntfile.js you can add an app parameter:

open: {
  server: {
    url: 'http://localhost:<%= connect.options.port %>',
    app: 'firefox'
  }
},

Pull request: https://github.com/jsoverson/grunt-open/pull/7

Commit: https://github.com/GabLeRoux/grunt-open/commit/6f2c7069767e58160ec96aaaa8fa20ed210ba183


Command Line Parameters

It is possible to pass command line parameters in the app string, such as app: "chromium-browser --incognito" - @bk11425