【问题标题】:Sublime Text 2 - open file at specific url addressSublime Text 2 - 在特定的 url 地址打开文件
【发布时间】:2013-11-20 22:27:16
【问题描述】:

当我在 Sublime Text 2 中编辑一个 html 文件时,我想在 Chrome 中打开它来查看它。理想情况下,我会执行键盘快捷键来执行此操作。

我为此创建了一个自定义的“Chrome”构建文件,它会在每次保存文件时在 Chrome 中打开该文件。这很好,但问题是它在以下网址打开文件:

file://localhost/Users/scott/Sites/my-new-site/video.html

我宁愿它在以下位置打开一个文件:

http://localhost/~scott/my-new-site/video.html

即我想让它知道文件在哪里,替换:

replace('file://localhost/Users/scott/Sites/')
with 'http://localhost/~scott'  
and open Chrome at that newly assembled url

有人知道怎么做吗?这是对我的构建文件的自定义吗?或者这是另一个有人知道的插件?

更新

我确实尝试过https://github.com/adampresley/sublime-view-in-browser ST2 插件。虽然它确实有效,但我必须为我想以这种方式打开的每个项目编辑项目配置。这有点痛苦,因为我不一定要在 ST2 中编辑我的所有项目。我宁愿有一种集中的方式,我可以假设我打开的文件是相对于我的本地服务器的 DocumentRoot ... /Users/scott/Sites 的。

谢谢,斯科特

【问题讨论】:

  • 您是否在localhost 上运行网络服务器?如果你不这样做,它就不会提供 HTTP。
  • 是的,我在 Macbook Pro 的 80 端口上运行股票 apache。

标签: google-chrome sublimetext2 sublime-text-plugin


【解决方案1】:
  1. 安装 SideBarEnhancer
  2. 现在右键单击侧栏中的目录和项目 > 编辑预览 URL
  3. 根据你的路径粘贴下面的代码

    { "D:\Web\localhost\tanxerina":{ "url_testing":"http://localhost/tanxerina.com", "url_production":"http://www.tanxerina.com" } }

【讨论】:

    猜你喜欢
    • 2013-09-18
    • 2012-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多