gulp-webserver:如果可用,默认为 index.html,否则显示目录

gulp-webserver: Default to index.html if available, else show directories

这是我当前的 gulp-网络服务器设置。

gulp.task('server', function(){
  gulp.src('dist/')
  .pipe(webserver({
    open: true,
    directoryListing: {enable: true},
    fallback: 'index.html'
  }));
});

如果存在,我希望能够默认为 index.html,否则显示目录列表。

目前这行不通,可以吗?

我最终使用 local-web-server which has this functionality, and gulp-shell 来触发它。

gulp.src()
.pipe(shell(([ 
  'ws -d dist/'
]))