I have a problem with my gulp webserver. I have this gulp task:
gulp.task('serve', ['watch'], () => {
gulp.src('tmp')
.pipe(webserver({
livereload: true,
directoryListing: true,
open: true,
//defaultFile: 'index.html'
}));
});
When running gulp serve
I am getting the following screen on localhost:8000:
It seems like that the webserver is serving the root directory of my project and not tmp folder, the odd thing is if I click the index.html I am redirected to http://localhost:8000/index.html
which is the correct file (tmp/index.html
and not /index.html
).
I am using gulp-webserver
for serving and live reload.
What did I do wrong?
Note: uncommenting the defaultFile doesn't help.
You can pass an object into directoryListing to adjust this setting.
.pipe(webserver({
directoryListing: {
enable: true,
path: 'tmp'
}
}));
Details: https://github.com/schickling/gulp-webserver#options
open can be also a string.By providing a String you can specify the path to open (for complete path, use the complete url http://my-server:8080/public/) .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With