Recently, the company to drive a project, is mobile, not how to do the mobile development, this project is a small attempt.
In the process of doing the project, the use of an artifact-Browser-sync, here to share to you.
1. Static page debugging
As a front-end, it must be to ensure the compatibility of the page.
The usual test scenario is that the front-end personnel manual n test machine, change the page, and then manually refresh each phone, really very egg pain, these repetitive work, should not be done by the person, and should be completed automatically by the machine, at this time, Browser-sync embodies its great value.
With it, the front-end staff can be freed from tedious repetitive work, more focused on solving technical problems.
Browsersync relies on node. js, how to install node. js here is no more.
On the command line, browser-sync the following command on the global installation:
NPM install-g Browser-sync
Once the installation is complete, we are ready to start debugging.
Before commissioning, we need to be in a local area network with the phones that make sure the tests are used and the locally developed machines .
Start debugging we deal with the situation in two cases:
A, the local does not build a server environment
For simple static pages, we need to use the--server command to Browser-sync.
Assuming that my static pages are all in the C:\wamp\www\openadmin\style\html\ directory,
Enter into C:\wamp\www\openadmin via the console (that is, change the directory to the root of the server), typing the following command:
Browser-sync start--server--files "style/html/*.html"
You can see the startup of the local server.
You can see this page by entering http://localhost:3000/style/html/module.html in the address bar.
To the browser to install a two-dimensional code plug-in, test Phone scan QR code, open the Module.html page.
We modify the Module.html page on the development machine, when the Miracle appeared, N opened the page of the mobile browser are simultaneously refreshed, cool, capricious!
According to gourd painting scoop, commissioning go!
B, the Local has built the server environment
I set up the server locally, setting the Vhost local.openadmin.com point to the C:\wamp\www\openadmin\ directory
At this point I simply typed the following command in the console:
Browser-sync start--proxy local.openadmin.com--files "style/**"
To start the service.
You can see this page by entering http://localhost:3000/style/html/module.html in the address bar.
-------------------------------------------Lonely cold dividing line------------------------------------------------------
For more information, you can take Browser-sync's official website http://www.browsersync.io/
Above, thank you
Mobile-page debugging artifact-browser-sync