Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Last active May 8, 2019 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harrisonmalone/c60269fe5b3a623e59f8ef56a0d8bb72 to your computer and use it in GitHub Desktop.
Save harrisonmalone/c60269fe5b3a623e59f8ef56a0d8bb72 to your computer and use it in GitHub Desktop.

Mobile testing on localhost 🐨

if you're designing for mobile you can run your localhost connection on your phone

it helps me a lot as sometimes the mobile web viewer in developer tools isn't exactly pixel perfect

to get this working you have to do a tiny bit of config

on a mac go to system preferences > network and then you'll see the message wifi is connected to <name of wifi> and has the IP address <some numbers like 192.354.0.36>

copy the IP address number

then you need to start your server

instead of running rails s run rails s --binding=0.0.0.0

explanation here https://stackoverflow.com/a/29580006

it means that your app will listen to requests from everywhere

to test it out first on your computer, paste the IP address into your browser url field with port 3000

an example

192.354.0.36:3000

if this works you can then put this address into your phones browser and it will work

every time you make edits to your views refresh your mobile browser and you'll see the changes

shout out to Tim for this workflow as he was using it during the portfolio projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment