Sublime Setup for Mamp open in browser

After a while got really in love with the Sublime text 2 , but one thing never got working even after installing several packages from Git Hub to open files in the Browser on a local MAMP Server. Several solution and extensions are available for Sublime text 2 but most explain how to setup open in browser for windows and feine keys if you have you APPs on a default location. Sublime is a hyperfast and stable  cross platform Text and Code editor for all who loved Notepad ++ will like even more Sublime Text 2 .

After all html php files open on the wrong path the solution with file replace worked best as my application folder are on a different hard drive . Based on these tutorial fromFluidWebStudio . That would work if you have your apps in default location , in my case it fires up firefox for windows or cant find the right path for the browser and the local files.

Default Open in Browser

{
	"cmd": ["open" , "-a" , "Chrome" , "https://localhost:8888/${file}"]
}

In this example we use

MAMP  on localhost:8888

All web projects on the hard drive: /www

Applications on hard drive: Volume/Meta

Open in Browser with Build short cut : ALT + CMD + B

All Files open up on localhost:8888/Volumes/www/dev/myfiles.php  instead of

localhost:8888/dev/myfiles.php  with the  Suggestion from Sublime forum  julamb helped me finally to get it run as it should. Simply search and replace the part you don’t need in the path. Start with a small partial replace and extend it shortly to prevent syntax errors.

${ file/ search / replace /}

Each /  need to be escaped with \\.

Build for Google Chrome

{
	"cmd": ["open" , "-a" , "/Volumes/Meta/Applications/Google Chrome.app" , "https://localhost:8888/${file/\\/Volumes\\/www\\///}"]
}

Build for Safari

{

"cmd": ["open" , "-a" , "/Volumes/Meta/Applications/Safari.app" ,  "https://localhost:8888/${file/\\/Volumes\\/www\\///}"]

}

Build for Firefox

{
	"cmd": ["open" , "-a" , "/Volumes/Meta/Applications/Firefox.app" ,  "https://localhost:8888/${file/\\/Volumes\\/www\\///}"]
}

Second example open in default Chrome Browser on the main drive and opem on my localhost domain https://metaap.com
replace www Users and Myusername from $file

{
"cmd": ["open", "-a", "Google Chrome", "https://metaap.com/${file/\\/Users\\/MYUSERNAME\\/www\\///}"]
}

 

 

Some more must  have Sublime Extensions

Sublime SideBar Extension  ( for some reason dont run right away but after deactivating and reactivating the package it runs )

LiveReload Browser extension to auto reload Sublime pages

Spectaclefast move your windows into right place  ,Move and resize your windows with ease short cuts

More great video tutorial how to work with Submlime that beats Coda and Espresso from Russia @andreyvit