Say you"re coding HTML in Sublime Text và you want to kiểm tra how it looks in a browser. Some text editors (BBEdit, for instance) have a feature that lets you open your page in a browser, but Sublime Text does not. Here"s how to vày it in Sublime Text.

Bạn đang xem: Sublime text view in browser plugin

Install a browser selection tool

Since you"re a website developer, you"re going to (a) have more than one web browser on your computer, & (b) want to demo your work in more than one browser. To make your life easier, you need lớn install a browser selection tool. In my my book, Mac OS X Snow Leopard for nguồn Users, I explained it this way:

I keep several website browsers on my Mac at all times, and I lượt thích to switch back & forth between them. In fact, sometimes I"ll click on a link and want to mở cửa it in Safari, because I want to print the page & I find Safari does that better than any other browser, but a few minutes later I"ll click on a liên kết and want to mở cửa it in Firefox, because I have that browser mix up to handle downloading music và movies. In Mac OS X, as in Windows & Linux, I can specify a default browser for my system, but that browser is used for everything. Wouldn"t it be nice if I could choose between browsers on the fly, as needed?

With a browser selection tool, you can! Here are my recommendations:

Install them, configure them to recognize the website browsers on your computer (Firefox, Chrome, Opera, Safari, & IE if you use Windows), & set them as the mặc định web browser on your computer. How you bởi that depends upon your OS:

Mac OS X: mở cửa Safari & then select Safari > Preferences > General. For default Web Browser, select MultiBrowser.Windows: Click on the Start thực đơn (or its equivalent) & enter phối Your mặc định Programs in the search box. In the resulting window, select Browser Chooser & then click on phối This Program As Default.

Method 1: Install the View In Browser plugin

This is the easiest method, but I couldn"t get it lớn work on my Mac. Note that I"m assuming you"ve installed the Package Control extension for Sublime Text.

Press Command-Shift-P (if you use a Mac) & Ctrl-Shift-P (if you use Windows) to mở cửa the Command Palette.

Type Install Package until you see that "Package Control: Install Package" is selected. Press Enter.

In the text box, start typing View In Browser until that package is selected. Once it is, press Enter to install it.

Restart Sublime Text.

Xem thêm: Lịch Sử La Mã Cổ Đại - Các Giai Đoạn Lịch Sử Ở La Mã Cổ Đại

Now when you have a web page mở cửa in Sublime Text, just press Ctrl-Alt-V và your browser selection tool should open, letting you choose which browser lớn open.

You can read more about the View In Browser package at GitHub.

Method 2: Create a Build System

This is slightly more work, but you also get more control.

If you use a Mac, replace it with the following:

"cmd": <"open", "-a", "/Applications/", "$file">If you use Windows, replace it with the following:

"cmd": <"C:Program Files", "$file">Save the file. Name it Choose Browser.sublime-build. Sublime Text should be smart enough khổng lồ put it in the right place for you, but if it doesn"t, save it to the following locations:

Mac OS X: ~/Library/Application Support/Sublime Text 2/Packages/UserWindows:

Restart Sublime Text.

Now when you want lớn preview your work in Sublime Text in a website browser, vị one of the following:

Tools > Build

Your browser selection tool should open, allowing khổng lồ choose the browser in which you want to see your webpage.

You can learn more about Build Systems on Sublime Text at