当前位置: 移动技术网 > 科技>软件教程>编程开发 > Sublime Text 3怎么设配置浏览默认路径为localhost?

Sublime Text 3怎么设配置浏览默认路径为localhost?

2016年09月07日  | 移动技术网科技  | 我要评论
Sublime Text 3怎么设配置浏览默认路径为localhost?

sublime text 3 受到程序员的喜爱,被誉为码农神器,具体优点就不说了。在 sublime text 3 中,可以对当前编辑的页面调用浏览器进行预览,但是默认的浏览器路径为文件所在的磁盘路径,这样如果是php、asp文件的话,就不能正常工作,那么怎么配置浏览器默认的浏览路径为localhost呢,且听分解。

1、在 sublime text 3 中,安装 sidebarenhancements 侧边栏增强插件

2、sidebarenhancements 插件安装完成后,首先为 sidebarenhancements 指定默认浏览器。打开 " preference --> package settings --> side bar --> settings user-user"

3、在打开的文件中添加:

{

  "default_browser": "chrome" //one of this list: firefox, aurora, chrome, canary, chromium, opera, safari

}

默认的浏览器可以是列表中的任意一种,在这里我选择的是chrome,可以根据自己的情况进行选择。

4、为 sidebarenhancements 指定默认localhsot目录。在侧边栏任意文档上点击鼠标右键,选择 "project --> edit preview urls"

5、在打开的文件中添加如下内容:

{

    "e:/website/helloworld/":{

        "url_testing": "http://localhost:8008/",

        "url_production": "http://equipmentmgr.sinaapp.com/"

    }

}

1)"e:/website/helloworld/" 是项目在磁盘中的路径,请修改为你的项目地址

2)"url_testing" 是你本地的 localhost 地址

3) "url_production" 是项目线上地址

请根据自己的情况进行修改。

6、为浏览器绑定热键。

在 sublime text 3 中,打开 "preference --> package settings --> side bar --> key bindings-user",在打开的文件中添加如下内容:

[

{

        "keys": ["alt+f12"],

        "command": "side_bar_open_in_browser",

        "args": {

                    "paths": [],

                    "type": "testing",

                    "browser": ""

                }

    }

]

在此,我为浏览器绑定的热键是 "alt + f12",可以根据自己的使用习惯进行修改。

7、至此,所有设置已经完成,可以在页面中按相应的热键,调用在配置文件中设置好的浏览器进行浏览。

注意事项:

用 package control 安装的 sidebarenhancements 只支持 sublime text 3,不支持旧版本的 sublime text 2

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网