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
While the answers in here helped fix my occurrence of the problem, as someone who's not very familiar with grunt, I had a hard time figuring just exactly where I was supposed to put the "open:" stanza in my Gruntfile.js. It took me about three three tries for me to find the right spot (e.g I tried directly under 'grunt.initConfig' and under 'connect: options:' to no effect)
I'm using the Gruntfile.js as generated by the standard angular yeoman generator.
I'm posting where I put it in this file just to give a little more "context" for anyone in a similar predicament.
Here is the relevant snippet of the Gruntfile.js:
Quick Answer
In
Gruntfile.js
you can add anapp
parameter: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"
- @bk11425From the documentation of grunt connect: https://github.com/gruntjs/grunt-contrib-connect
You can use:
i.e. appName: 'Google Chrome'
The grunt server task has almost nothing to do with the browser, it just starts a static server for you to connect to and preview your app. You could theoretically use any browser you want to connect to
http://localhost:8080/
To clarify based on the poster's comment:
grunt-open
is a different task than grunt-server: https://npmjs.org/package/grunt-open.grunt-open
usesnode-open
which just defaults to the defaultopen
task for darwin orstart
for win32: https://github.com/jjrdn/node-open#how-it-worksSo, to answer, whatever application you have specified to open
.html
files (or whatever you're opening) will open with this task.