Skip to content

Launch site after ng serve? #1245

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

Closed
rburnham52 opened this issue Jun 29, 2016 · 8 comments
Closed

Launch site after ng serve? #1245

rburnham52 opened this issue Jun 29, 2016 · 8 comments

Comments

@rburnham52
Copy link

rburnham52 commented Jun 29, 2016

Is it possible to have ng serve launch your site after it starts up? I find this easier than having to copy the localhost with port address from the terminal and paste it into a new browser tab

@austingreendev
Copy link
Contributor

This could be pretty easy to implement. I've done this before with the OPN package https://www.npmjs.com/package/opn.

There could be an additional flag on the serve command similar to the ones below:

  • ng serve --browser to open the default browser
  • ng serve --browser=firefox to open a specific browser

If anyone else thinks this is a good idea I may try a pull-request at this one.

@rburnham52
Copy link
Author

Being able to select a browser like you suggested would be a nice touch as well.

@filipesilva
Copy link
Contributor

Dupe of #1081

@filipesilva
Copy link
Contributor

Please feel free to continue the discussion and proposals in the other issue though!

@keepscoding
Copy link

@Austin94 do you mind show how you implement OPN?

@austingreendev
Copy link
Contributor

austingreendev commented Jul 25, 2016

@keepscoding This conversation should probably be moved to the duplicate issue if that's still active, but from opn README https://www.npmjs.com/package/opn (or you can use the opn-cli package) we could just grab the port that it was started on and add the app name based off of a argument passed in.

// specify the app to open in 
opn('http://localhost:3000', {app: 'firefox'});
opn('http://localhost:3000', {app: 'google chrome'});

// for default browser
opn('http://localhost:3000');

@keepscoding
Copy link

@Austin94 where to add these code e.g. open default browser?

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants