browsersync (browser synchronization testing tool) is very popular among programming enthusiasts.
Here's how to install and use it:
Step 1: Install node.js.
Official website: https://nodejs.org/en/ , generally click the first download button, this is the stable version.
After installation, you need to see if the installation is successful: press win+R on the keyboard, enter cmd, press Enter, enter node -v
Step 2: Install browsersync (a browser synchronization test tool).
win+r, enter cmd, press Enter, and copy this command:
1 npm install -g browser-sync
Enter and wait for the installation to complete.
Step 3: Create a project, enter the specific path of the project, hold down shift, right-click on the blank space, select Open the command window here, and execute the following command:
For example: if there is an html folder in the d drive directory, and a file is index.html (this file is the file to be debugged), then the "file path" is "d:/html"
1 // --files path is relative to the project (directory) running the command 2 browser-sync start --server "d:/html" --files "css/*.css"
Note: The above css is the file type to be monitored. If you want to increase the detection of html files, you can execute the following command
1 browser-sync start --server "d:/html" --files "css/*.css, *.html"
Note: In the win10 system, the above statement must be executed to take effect, otherwise http://localhost:3000/ will prompt: Cannot GET /
In win7 system, you don't need to write the specific path, for example:
1 browser-sync start --server --files "css/*.css, *.html"