我用本地服务的时候,没有问题。代理服务的时候,浏览器自动刷新了,但是改的容没变,还是得手动刷新一次才可以,请问这是哪里有问题,代码如下
/**
* sass
*/
gulp.task('sass',function(){
return gulp.src('sass/portal/portalHomepage.scss')
.pipe(plugins.sass().on('error', plugins.sass.logError))
.pipe(gulp.dest('./page/portal'))
.pipe(reload({stream:true}));
});
/**
* pug
*/
gulp.task('pug',function(){
return gulp.src('jade/portal/portalHomepage.pug')
.pipe(plugins.pug({pretty:true}))
.pipe(gulp.dest('./page/portal'))
.pipe(reload({stream:true}));
});
/**
* 代理服务器 + 监听 scss/pug/js 文件
*/
gulp.task('server',['sass','pug'],function(){
browserSync.init({
port:8083,
browser:'chrome',
proxy:{
target:'http://localhost:8081/court-digital-library-search/page/index.html',
ws:true
}
});
gulp.watch('sass/portal/portalHomepage.scss',['sass']);
gulp.watch('jade/portal/portalHomepage.pug',['pug']);
gulp.watch('page/**/*.js').on('change',reload);
});