我正在尝试使用 gulp-live-server
来自动重启我的服务器并在我的代码更改时刷新页面。
这是我的基本设置:
在我的 server.js 上:
app.use(require('connect-livereload')());
我的 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)();
});
});
我的服务器成功重启,但浏览器从未刷新。
感谢您的帮助。
最佳答案
尝试在调用通知时传递文件:
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);
});
});
关于javascript - gulp-live-server 不刷新页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33578125/