Home Download Buy Blog Forum Support

Browser preview in localhost

Browser preview in localhost

Postby 718bklynqns on Sat Sep 15, 2012 12:21 am

I realize they're ways to open files in a browser (builds, plugins, and packages).
What I want to do is have the file open locally.I maybe missing something because it used to work. RIght now the preview generates the following in the navigation file:///Applications/MAMP/htdocs/barbsSite.dev/index.html instead of http://localhost/barbsSite.dev/

I know since I am using LiveReload, I could just type in http://localhost/barbsSite.dev/ once and it would refresh afterwards on it's own. And for that matter I could do that in all my testing browsers. But that would mean at least 3 other times!

Come on there has to be folks like me who have watched Paul Irish and want to be efficient!

I have been searching for a few days and don't feel like going back to coda2...Please help!
718bklynqns
 
Posts: 4
Joined: Sat May 26, 2012 12:55 pm
Location: queens

Re: Browser preview in localhost

Postby julamb on Sat Oct 20, 2012 12:14 am

I'm a bit late but this should work.
You can do it by creating a new build system (in Tools > Build System > New Build System...) and doing replacement in the $file variable to change "/Applications/MAMP/htdocs/" to "http://localhost".

Something like this should work for you:
Code: Select all
{
   "cmd": ["open", "-a", "Safari", "${file/\\/Applications\\/MAMP\\/htdocs/http:\\/\\/localhost/}"]
}


Escaping the slashes makes it look complicated but the base format is ${file/search/replace/} and each / has to be escaped with \\.

Once you have selected this Build System, you should be able to preview any file under the htdocs directory on localhost with CMD+B.
julamb
 
Posts: 1
Joined: Thu Oct 18, 2012 4:53 pm

Re: Browser preview in localhost

Postby adamhuxtable on Sun Oct 21, 2012 6:29 pm

How would I do the same but without using MAMP, I just Apache setup.

Thanks
Adam
adamhuxtable
 
Posts: 2
Joined: Sun Oct 21, 2012 5:59 pm


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot] and 22 guests