Build System > HTML) to run and preview the HTML file."/> Build System > HTML) to run and preview the HTML file.">

Home >Development Tools >sublime >How to run html after writing code in sublime

How to run html after writing code in sublime

下次还敢
下次还敢Original
2024-04-03 07:18:181217browse

Run HTML: Install the HTML preprocessor (such as HTML-CSS-JS Prettify), configure user settings, and specify the preprocessor as the default ("html_prettify_on_save": true) to save the HTML file (.html) using the shortcut key (Ctrl B/Cmd B) or menu (Tools > Build System > HTML) to run and preview HTML files.

How to run html after writing code in sublime

How to run HTML with Sublime Text

Sublime Text is a popular code editor for writing and Edit various programming languages, including HTML. To run HTML with Sublime Text, follow these steps:

Step 1: Install the HTML preprocessor

Sublime Text does not come with HTML by default for running HTML preprocessor. Therefore, you need to install one. There are several popular choices, such as:

  • HTML-CSS-JS Prettify
  • HTML-CSS-JS Formatter
  • Elm Format

Go to Package Control and search for the required preprocessor. Follow the instructions that appear to install.

Step 2: Configure User Settings

After installing the preprocessor, you need to configure the user settings for Sublime Text to designate it as the default preprocessor. Open Sublime Text's Preferences > Settings file and add the following line:

<code>"html_prettify_on_save": true</code>

Step 3: Save your HTML file

Write your HTML code and save it as a .html file.

Step 4: Run the HTML file

There are two ways to run the HTML file in Sublime Text:

  • Use Keyboard shortcut: Pressing Ctrl B (Windows/Linux) or Cmd B (Mac) will run and preview the HTML file using the preprocessor.
  • Using the Sublime Text menu: Go to Tools > Build System > HTML and select Build. This will run the HTML file using the preprocessor and display the resulting HTML file in Sublime Text.

Note: To see how an HTML file will look in the browser, you will need to drag and drop the file into the browser window or manually enter the file into the browser address bar path.

The above is the detailed content of How to run html after writing code in sublime. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to execute sublimeNext article:How to execute sublime