JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11785
  • Score
    100M100P100Q140241F
  • License MIT

Gulp plugin to run a local webserver with LiveReload

Package Exports

  • gulp-webserver

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-webserver) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gulp-webserver Build Status

Streaming gulp plugin to run a local webserver with LiveReload

Hint: This is a rewrite of gulp-connect

Install

$ npm install --save-dev gulp-webserver

Usage

The gulp.src('root') parameter is the root directory of the webserver. Multiple directories are possible.

var gulp = require('gulp');
var webserver = require('gulp-webserver');

gulp.task('webserver', function() {
  gulp.src('app')
    .pipe(webserver({
      livereload: true,
      directoryListing: true
    }));
});

Options

Key Type Default Description
host String localhost hostname of the webserver
port Number 8000 port of the webserver
livereload Boolean/Object false whether to use livereload. For advanced options, provide an object. You can use the 'port' property to set a custom live reload port.
directoryListing Boolean/Object false whether to display a directory listing. For advanced options, provide an object. You can use the 'path' property to set a custom path or the 'options' property to set custom serve-index options.
fallback String undefined file to fall back to (relative to webserver root)
https Boolean false feature coming soon
middleware Array [] feature coming soon

FAQ

Why can't I reach the server from the network?

Solution: Set 0.0.0.0 as host option.

How can I use html5Mode for my single page app with this plugin?

Solution: Set the index.html of your application as fallback option. For example:

gulp.task('webserver', function() {
  gulp.src('app')
    .pipe(webserver({
      fallback: 'index.html'
    }));
});

License

MIT License