Gulp automatically refresh the plug-in a lot, but feel the best use or Browser-sync plugin. If you do not want to use the command line, you can also use the Browser-sync interface tool
Install the Browser-sync plugin first:
NPM Install Browser-sync--save-dev
Issues that you may experience installing the Browser-sync plugin http://www.cnblogs.com/ayseeing/p/4201202.html
Browser-sync API
The Gulpfile.js file code is as follows:
The dependency module first introduces var gulp = require ("Gulp"), Browsersync = require ("Browser-sync");//Auto Refresh Browser-sync startgulp.task (' Browser ', function () { Browsersync ({ //host:172.16.157.1, port:8082, open:true, //path Show/d start Startpath: "/d", //timestamps:false, server: { directory:true, routes: { '/d ': "./dist/ New.html " }, middleware:function (req,res,next) { console.log (" middleware "); Next (); }, BaseDir: './' }, //Specify browser //browser: "Google Chrome"//or ["Google Chrome", " Firefox "] //delayed refresh, default 0 reloaddelay:1000, //whether to load CSS modifications, default true Injectchanges:false }); Gulp.task (' Bro ', function () { gulp.src ('./dist/** ') . Pipe (Browsersync.reload ({stream:true}));}); Gulp.task (' Default ', [' Bro ', ' browser '],function () { gulp.watch ('./dist/** ', [' bro ']);}); /Auto Refresh Browser-sync End
Gulp Auto Refresh Plugin