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

feat(dev): document how to disable browser auto launch #4106

Merged
merged 3 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/commands/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ netlify dev
netlify dev
netlify dev -d public
netlify dev -c "hugo server -w" --targetPort 1313
BROWSER=firefox netlify dev # auto open firefox instead of preferred browser
BROWSER=none netlify dev # disable browser auto opening
```

---
Expand Down
7 changes: 7 additions & 0 deletions docs/netlify-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ EXAMPLES
$ netlify dev -c "hugo server -w" --targetPort 1313
```

The command will automatically open your preferred browser to serve the application. You can customize this behaviour by using the `BROWSER` environment variable:

```bash
$ BROWSER=firefox netlify dev # this would use firefox instead of your preferred one
$ BROWSER=none netlify dev # this will disable the auto opening of the browser
```

## Live Share

To share your ongoing dev session with a coworker, just run Netlify Dev with a `--live` flag:
Expand Down
8 changes: 7 additions & 1 deletion src/commands/dev/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,13 @@ const createDevCommand = (program) => {
'specify the path to a local GeoIP location database in MMDB format',
).hideHelp(),
)
.addExamples(['netlify dev', 'netlify dev -d public', 'netlify dev -c "hugo server -w" --targetPort 1313'])
.addExamples([
'netlify dev',
'netlify dev -d public',
'netlify dev -c "hugo server -w" --targetPort 1313',
'BROWSER=firefox netlify dev # auto open firefox instead of preferred browser',
Copy link
Contributor

@erezrokah erezrokah Jan 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit should work (setting to firefox), but currently doesn't due to an upstream bug:
michaellzc/better-opn#38

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow, the only thing I didn't try.. my bad, I'll change it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, better to remove it for now

'BROWSER=none netlify dev # disable browser auto opening',
])
.action(dev)
}
module.exports = { createDevCommand }