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

browser-sync start --open does not work with URL #1982

Open
2 of 10 tasks
xgqfrms opened this issue Nov 16, 2022 · 3 comments
Open
2 of 10 tasks

browser-sync start --open does not work with URL #1982

xgqfrms opened this issue Nov 16, 2022 · 3 comments

Comments

@xgqfrms
Copy link

xgqfrms commented Nov 16, 2022

Issue details

browser-sync start --open does not work with URL

# Choose which URL is auto-opened (local, external or tunnel), or provide a url
$ browser-sync start --open 'http://localhost:3000/public/index.html' --server --files './**/*.*'

https://browsersync.io/docs/command-line

Steps to reproduce/test case

  1. create a new node.js project, with a public folder and index.html file
  2. run npm script
# Choose which URL is auto-opened (local, external or tunnel), or provide a url
$ browser-sync start --open 'http://localhost:3000/public/index.html' --server --files './**/*.*'

opened http://localhost:3000/

wanted http://localhost:3000/public/index.html

image

image

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

  • Browsersync [ 2.26.7 ]
  • Node [ 18.12.0 ]
  • Npm [ 8.19.2 ]
$ browser-sync --version
# 2.26.7

$ node -v
# v18.12.0

$ npm -v
# 8.19.2

Affected platforms

  • linux
  • windows
  • OS X
  • freebsd
  • solaris
  • other (please specify which)

Browsersync use-case

  • API
  • Gulp
  • Grunt
  • CLI

If CLI, please paste the entire command below

# Choose which URL is auto-opened (local, external or tunnel), or provide a url
$ browser-sync start --open 'http://localhost:3000/public/index.html' --server --files './**/*.*'
@xgqfrms xgqfrms changed the title browser-sync star --open does not work with URL browser-sync start --open does not work with URL Nov 16, 2022
@trusktr
Copy link

trusktr commented Sep 9, 2023

I noticed this too. Instead, I got it working with --startPath. For example, I think what you were trying to do is equivalent to this:

browser-sync . --startPath=/public/index.html --watch

then it automatically opens the browser to http://localhost:3000/public/index.html.

@shakyShane
Copy link
Contributor

thanks @trusktr, that's correct.

Agree with the original post too though - this should 'just work' with --open

@shakyShane
Copy link
Contributor

shakyShane commented Sep 9, 2023

also side note, that command in the original post could probably be shorted to

# before
browser-sync start --open 'http://localhost:3000/public/index.html' --server --files './**/*.*'

# after
browser-syn public -w

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants