Browser-sync is a very useful way to access the Web page from different terminals by a web address given on the same LAN, which greatly solves the predicament that we have to install various environments or software because the Web page needs to be browsed on the phone or ipad. Now let me take a look at the process of installing this awesome plugin:
1, first of all, you have to ensure that you have a node. JS environment on your computer, then we use the Terminal node. JS Package Manager NPM To do the next thing;
2, the implementation of NPM install-g Browser-sync;
3, followed by the implementation of Browser-sync this step I have a big problem, because the computer does not have the X-code tool installed, but we first execute: sudo npm install npm-g, to ensure that we install the node version is the latest, and then check your version , the execution order is npm-v,node-v;
4, Next we will formally start the creation of the project, now create a folder on the desktop: Execute
mkdir Liuhuan-browsersync (here is the file name);
5, the implementation of CD Liuhuan-browsersync; go to the folder.
6, the implementation of NPM Init; Here is the creation of repository information, all the way to enter;
7, the implementation of NPM install Browser-sync-save-dev; This step is to install Browser-sync in the folder, right, need to install in node once, folder installed once;
8, the implementation of LS; See if there is a node_modules this item;
9, execute LS node_modules, see if there is browser-sync this folder;
To use in a project:
Copy the well-written project folder directly to the Liuhuan-browsersync folder or create a new project folder directly in the Liuhuan-browsersync folder.
Then open the Terminal CD folder name here is the CD Desktop/liuhuan-browsersync,
And then execute
Browser-sync start-server Web-app (project folder name)-files "web-app/*"
Installing Browser-sync