吞噬networking服务器和livereload
我的网页服务器有问题。 我有这个吞咽任务:
gulp.task('serve', ['watch'], () => { gulp.src('tmp') .pipe(webserver({ livereload: true, directoryListing: true, open: true, //defaultFile: 'index.html' })); });
运行gulp serve
我得到以下屏幕localhost:8000:
这似乎是networking服务器服务于我的项目的根目录,而不是tmp文件夹,奇怪的是,如果我点击index.html我redirect到http://localhost:8000/index.html
这是正确的文件( tmp/index.html
而不是/index.html
)。
我正在使用gulp-webserver
进行服务和实时重新加载。
我做错了什么?
注意:取消注释defaultFile没有帮助。
您可以将对象传递到directoryListing以调整此设置。
.pipe(webserver({ directoryListing: { enable: true, path: 'tmp' } }));
详情: https : //github.com/schickling/gulp-webserver#options
打开也可以是一个string。通过提供一个string,你可以指定打开的path(完整的path,使用完整的URL http:// my-server:8080 / public / )。
尝试这个
gulp.task('serve', ['watch'], () => { gulp.src('./tmp') .pipe(webserver({ livereload: true, directoryListing: true, open: true, //defaultFile: 'index.html' })); });