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

Browsersync doesn't set the right local url #453

Closed
omargourari opened this issue Feb 16, 2015 · 3 comments · May be fixed by GerHobbelt/browser-sync#15
Closed

Browsersync doesn't set the right local url #453

omargourari opened this issue Feb 16, 2015 · 3 comments · May be fixed by GerHobbelt/browser-sync#15

Comments

@omargourari
Copy link

Here's an issue (already posted on http://stackoverflow.com/questions/28500695/browsersync-doesnt-set-the-right-local-url) regarding the local url configurations option.

As described in the so question I'm working on a wp theme project using the starter theme roots.

My main concern is about the possibility to set the local url based on the url created by Mamp pro.
I, basically, don't do any change in the hosts file but I just set up a local development website through Mamp and the resulting url is http://mywebsite:8888.

Now, setting the port number as 8888 give me, correctly, the following url http://localhost:8888 but, even if I'm able to see the changes and the page keep refreshing alongside my changes, I'd like to have the local url set as http://mywebsite:8888.

Any similar concern?

Thank you

@shakyShane
Copy link
Contributor

The only way to do this would be manually injecting the snippet into your site's footer.

run BrowserSync with neither server or proxy options and you'll be presented with a snippet that you can paste into your website.

:)

@zackphilipps
Copy link

Pasting the snippet as-is didn't work for me, and no amount of modification works for me either. Is there something I'm missing? Here's the snippet I was given:

<script type='text/javascript' id="__bs_script__">//<![CDATA[
document.write("<script async src='http://HOST:3000/browser-sync/browser-sync-client.2.8.2.js'><\/script>".replace("HOST", location.hostname));
//]]></script>

and here's another one I tried:

<script type='text/javascript' id="__bs_script__">//<![CDATA[
document.write("<script async src='http://HOST:PORT/browser-sync/browser-sync-client.2.8.2.js'><\/script>".replace("HOST", location.hostname).replace(/PORT/g, location.port));
//]]></script>

I'm using BrowserSync with a Gruntfile and MAMP PRO. Please advise.

ADDENDUM: When I go to localhost:3000 in my browser, I get Cannot GET /.

@zackphilipps
Copy link

Nevermind. I don't think me and OP are experiencing the same problem, so this fix won't work for me.

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

Successfully merging a pull request may close this issue.

3 participants