Home Download Buy Blog Forum Support

how to view in browser

Re: how to view in browser

Postby CanarySPA on Sat Jun 30, 2012 11:52 pm

I'm sorry ... But not knowing Python I do not know what methods or functions would be to do what you ask ...

Web files that you open the browser as text or the download is because they are server-side languages​​. You can configure MAMP PRO, and have the root folder (documentRoot en MAMP PRO) of the server as "/". Then in the plugin that we created in ST2 located in "YourUser / Library / Application Support / Users / filenameplugin.py, and modify the variable" url ":

import sublime, sublime_plugin
import webbrowser


class OpenBrowserCommand(sublime_plugin.TextCommand):
def run(self,edit,keyPressed):
url = "http://localhost:8888"
url += self.view.file_name()

if keyPressed == "1":
navegator = webbrowser.get("open -a /Applications/Google\ Chrome.app %s")
if keyPressed == "2":
navegator = webbrowser.get("open -a /Applications/Firefox.app %s")
if keyPressed == "3":
navegator = webbrowser.get("open -a /Applications/Safari.app %s")
navegator.open_new(url)


Hope you good! If so, tell me what's wrong and help you again.
Again, sorry for my English ...
CanarySPA
 
Posts: 2
Joined: Sun May 06, 2012 3:34 am

Previous

Return to General Discussion

Who is online

Users browsing this forum: JohnArcher and 38 guests