[英]gulp-live-server doesn't refresh page
I'm trying to use gulp-live-server
to automatically restart my server and refresh the page whenever my code changes. 我正在尝试使用gulp-live-server
自动重启我的服务器并在我的代码更改时刷新页面。
Here is the basic setup I have: 这是我的基本设置:
On my server.js: 在我的server.js上:
app.use(require('connect-livereload')());
My gulp file: 我的gulp档案:
gulp.task('server', function () {
server = gls('app.js', options);
server.start();
// Watch for file changes
gulp.watch(['app.js', 'app/**/*.js', 'config/**/*.js', 'components/**/*.jsx'], function() {
server.start.bind(server)();
server.notify.bind(server)();
});
});
My server successfully does restart, but the browser does not refresh ever. 我的服务器成功重启,但浏览器不会刷新。
Help is appreciated. 感谢帮助。
Try by passing the file when calling notify: 尝试通过调用notify时传递文件:
gulp.task('server', function () {
server = gls('app.js', options);
server.start();
// Watch for file changes
gulp.watch(['app.js', 'app/**/*.js', 'config/**/*.js', 'components/**/*.jsx'], function(file) {
server.start.bind(server)();
server.notify.bind(server)(file);
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.