Sublime Text 2 编辑器是否支持实时 HTML 和 CSS 预览?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12823873/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:17:30  来源:igfitidea点击:

Does the Sublime Text 2 editor support real time HTML & CSS preview?

htmlcsssublimetext2sublimetext

提问by user1528138

Does the Sublime Text 2 editor support real time HTML & CSS preview?

Sublime Text 2 编辑器是否支持实时 HTML 和 CSS 预览?

回答by Sara

There's a package for this: Browser Refreshby Giovanni Collazo. It supports OS X and Windows 7, and all major browsers.
You can install it via Package Control (or manually) and trigger it with super+shift+rin Sublime Text 2.

有一个包:Giovanni Collazo 的浏览器刷新。它支持 OS X 和 Windows 7 以及所有主要浏览器。
您可以通过包控制(或手动)安装它并super+shift+r在 Sublime Text 2 中触发它。

I haven't tested it personally since I use CodeKitfor this functionality, but it seems popular.

自从我使用CodeKit来实现此功能以来,我还没有亲自测试过它,但它似乎很受欢迎。



更新:

Windows XP-compatible software

Windows XP 兼容软件

Chrome extensions

Chrome 扩展程序

Firefox addons

火狐插件

IE addons

IE插件


Note: Browser extensions will refresh at regular intervals, not when you save a file.


注意:浏览器扩展会定期刷新,而不是在您保存文件时刷新。

回答by koerbcm

I have found the easiest way to use Sublime with live HTML and CSS is to install WAMP(www.wampserver.com/en/) or XAMPP(www.apachefriends.org/en/xampp.html) which installs an Apache web server, PHP and Mysql server on your computer. Then you can edit your files in Sublime, and so long as they are located within the Apache web root folder (i believe its wamp/htdocs or xampp/htdocs) then you can go to localhost//filename.html and there is your html files. Save in Sublime and refresh the page and there are your changes.

我发现将 Sublime 与实时 HTML 和 CSS 一起使用的最简单方法是安装 WAMP(www.wampserver.com/en/) 或 XAMPP(www.apachefriends.org/en/xampp.html),它安装了一个 Apache Web 服务器,您计算机上的 PHP 和 Mysql 服务器。然后你可以在 Sublime 中编辑你的文件,只要它们位于 Apache web 根文件夹中(我相信它的 wamp/htdocs 或 xampp/htdocs)然后你可以去 localhost//filename.html 并且有你的 html文件。保存在 Sublime 中并刷新页面,您的更改就完成了。

You can also just open up the html file in Chrome or Firefox but selecting Open With... however, i have found that sometimes if you have dynamic content or links, they might not work correctly.

您也可以在 Chrome 或 Firefox 中打开 html 文件,但选择打开方式... 但是,我发现有时如果您有动态内容或链接,它们可能无法正常工作。