Gulp Auto Refresh Plugin

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.