Does the Sublime Text 2 editor support real time HTML & CSS preview?
问题:
回答1:
There's a package for this: Browser Refresh by 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+r
in Sublime Text 2.
I haven't tested it personally since I use CodeKit for this functionality, but it seems popular.
Update:
Windows XP-compatible software
- LiveReload (Windows version is pre-alpha) - there is also a supporting Sublime Text 2 package
- XRefresh - deprecated version of LiveReload (worth mentioning for stable XP compatibility)
- AutoHotKey - example
- VBS script - triggered by a keyboard shortcut
Chrome extensions
- Refresh Monkey
- Easy Auto Refresh
ChromeReloadAuto-ReloadAuto Refresh Plus
Firefox addons
- Tab Auto Reload
- ReloadEvery
IE addons
- AutoRefresher
Note: Browser extensions will refresh at regular intervals, not when you save a file.
回答2:
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.
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.