gulp-connect
Gulp plugin to run a webserver (with LiveReload)
Sponsors
gulp-connect is sponsored by JetBrains!
Install
npm install --save-dev gulp-connect
Usage
var gulp = connect = ; gulp; gulp;
LiveReload
var gulp = connect = ; gulp; gulp; gulp; gulp;
Start and stop server
gulp;
Multiple server
var gulp = stylus = connect = ; gulp; gulp; gulp; gulp; gulp; gulp;
http2 support
If the http2 package is installed and you use an https connection to gulp connect then http 2 will be used in preference to http 1.
API
options.root
Type: Array or String
Default: Directory with gulpfile
The root path
options.port
Type: Number
Default: 8080
The connect webserver port
options.host
Type: String
Default: localhost
options.name
Type: String
Default: Server
The name that will be output when the server starts/stops.
options.https
Type: Object
Default: false
Can be any options documented at https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
When https is just set to true
(boolean), then internally some defaults will be used.
options.livereload
Type: Object or Boolean
Default: false
options.livereload.port
Type: Number
Default: 35729
Overrides the hostname of the script livereload injects in index.html
options.livereload.hostname
Type: String
Default: 'undefined'
options.fallback
Type: String
Default: undefined
Fallback file (e.g. index.html
)
options.middleware
Type: Function
Default: []
options.debug
Type: Boolean
Default: false
options.index
Type: Boolean or String of a new index pass or Array of new indexes in preferred order
Default: true
gulp;
Contributing
To contribute to this project, you must have CoffeeScript installed: npm install -g coffee-script
.
Then, to build the index.js
file, run coffee -o . -bc src/
. Run npm test
to run the tests.