Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hey I've just started using Sublime Text 2 with the SidebarEnhancements package installed.

I have it setup so that when I press the build shortcut it previews in Chrome which is fine for my HTML files. I have apache setup on my machine and works fine when I type it in the browser.

What I was wondering was is there a way to when I build the page for it to open within the local host.

I have all my websites in the Sites folder and is the default location for apache.

I'm running the latest version of Sublime Text 2 on an iMac.

share|improve this question
    
Kinda off topic, but I found this yesterday and wanted to share it: PHP Built in Web Server – d_rail Oct 27 '12 at 21:11

this tutorial is for ubuntu, in your SO the path maybe are no the same

right click in any file go to project-> Edit Project Preview Url

add this line:

{
    "/home/user/Webs/your-site":   //path from your project
    {
        "url_testing": "http://localhost/your-site/",
        "url_production": "http://www.your-site.dev"
    }
}

(use absolute path, not the relative from project that you get from copy path)

share|improve this answer

Here is what you need for Mac. I am running Sublime Text 3 but I'm sure it would work fine in Sublime Text 2 just the same. Just change the 'USERNAME' to whatever you have as your own user name. I had to add extra space around the localhost due to this sites rules on links.

Chrome

{ "cmd": ["open", "-a", "Google Chrome.app", "http : // localhost:80 /${file/\/Users\/USERNAME\/Sites\///}"] }

Firefox

{ "cmd": ["open", "-a", "Firefox.app", "http : // localhost:80 /${file/\/Users\/USERNAME\/Sites\///}"] }

Safari

{ "cmd": ["open", "-a", "Safari.app", "http : // localhost:80 /${file/\/Users\/USERNAME\/Sites\///}"] }

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .