Plugin to run a local webserver with LiveReload based on gulp-webserver
Install with npm
npm install webserver-lite
var WebServer = require('./lib/webserver-lite');
var mainWebServer = new WebServer({
fallback: 'index.html',
root: path.resolve(__dirname, 'public')
});
var adminWebServer = new WebServer({
fallback: 'index.html',
proxies: true,
root: path.resolve(__dirname, 'public/build')
}, 'admin');
mainWebServer.start();
adminWebServer.start();
Server constructor
Extras
Type: Number
Shortcut for
livereload: {
enable: true,
port: <port>
};
Shortcut for
params.proxies = [{
source: '/' + params.segment,
target: 'http://localhost:' + params.port + '/'
}];
Type: String
Path segment. F.e. if segment: 'admin', proxies: true, fallback: 'index.html'
server will be use index.html
from admin directory if you get localhost:8000/admin/
serverDir
└──admin
└──index.html
© Oleg Istomin 2015. Released under the MIT license