Package Exports
- gulp-server-livereload
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-server-livereload) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
gulp-server-livereload 
Gulp plugin to run a local webserver with live reload using socket.io
This is a fork of gulp-webserver. This version uses socket.io instead of tiny-lr so that the livereload mechanism works even if your browser does not support WebSockets (PhoneGap developers rejoice!).
Installation
$ npm install --save-dev gulp-server-livereloadUsage
The folder supplied to gulp.src() will be the root folder from which files will be served.
var gulp = require('gulp');
var server = require('gulp-server-livereload');
gulp.task('webserver', function() {
gulp.src('app')
.pipe(server({
livereload: true,
directoryListing: true,
open: true
}));
});If you run gulp webserver your browser should automatically open up to http://localhost:8000 and show a directory listing of the app folder.
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 (default is 35729). |
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. |
defaultFile |
String | index.html |
default file to show when root URL is requested. If directoryListing is enabled then this gets disabled. |
open |
Boolean/Object | false |
open the localhost server in the browser |
https |
Boolean/Object | false |
whether to use https or not. By default, gulp-webserver provides you with a development certificate but you remain free to specify a path for your key and certificate by providing an object like this one: {key: 'path/to/key.pem', cert: 'path/to/cert.pem'}. |
log |
String | info |
If set to debug you will see all requests logged to the console. |
FAQ
Why can't I reach the server from the network?
Set 0.0.0.0 as the host option.
How can I set main.html to automatically load when I visit the URL?
Set the defaultFile to main.html:
gulp.task('webserver', function() {
gulp.src('app')
.pipe(server({
defaultFile: 'main.html'
}));
});License
MIT - see LICENSE.md