Generally, after installing VsCode, we need to install many plug-ins to make vscode support related functions. Let’s take a look at how vscode runs the front-end code.
vscode can install a static web server. Live Server is used to run front-end code for easy debugging. The latest Live Server already supports php dynamic pages.
The installation method is to click the fifth icon on the left to open the "Extensions" page, enter Live Server in the text box, click on the first search result, click Install on the right page, and wait for the installation to complete .
The operation method is to select the project and click the Go live button in the toolbar at the bottom of the screen. Click once again to stop the server.
Live Server has some default configuration options that users can modify. Click File->Preferences->Settings and find Live Server Config on the right page, which lists the configuration properties of this plug-in. Copy it to the right, modify the attribute values, and click Save.
For example, to modify the default port, you can copy the following code to the user settings on the right side of the page:
"liveServer.settings.port": 5501
Recommended related article tutorials: vscode tutorial
The above is the detailed content of How to run front-end code on vscode. For more information, please follow other related articles on the PHP Chinese website!