Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Command line parameters:
* `--wait=MILLISECONDS` - (default 100ms) wait for all changes, before reloading
* `--htpasswd=PATH` - Enables http-auth expecting htpasswd file located at PATH
* `--cors` - Enables CORS for any origin (reflects request origin, requests with credentials are supported)
* `--isolated` - Enable cross-origin isolation for using web features such as SharedArrayBuffer
* `--https=PATH` - PATH to a HTTPS configuration module
* `--https-module=MODULE_NAME` - Custom HTTPS module (e.g. `spdy`)
* `--proxy=ROUTE:URL` - proxy all requests for ROUTE to URL
Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ LiveServer.start = function(options) {
var browser = options.browser || null;
var htpasswd = options.htpasswd || null;
var cors = options.cors || false;
var isolated = options.isolated || false;
var https = options.https || null;
var proxy = options.proxy || [];
var middleware = options.middleware || [];
Expand Down Expand Up @@ -207,6 +208,9 @@ LiveServer.start = function(options) {
credentials: true // allowing requests with credentials
}));
}
if (isolated) {
app.use(require("isolated-middleware")());
}
mount.forEach(function(mountRule) {
var mountPath = path.resolve(process.cwd(), mountRule[1]);
if (!options.watch) // Auto add mount paths to wathing but only if exclusive path option is not given
Expand Down
6 changes: 5 additions & 1 deletion live-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ for (var i = process.argv.length - 1; i >= 2; --i) {
opts.cors = true;
process.argv.splice(i, 1);
}
else if (arg === "--isolated") {
opts.isolated = true;
process.argv.splice(i, 1);
}
else if (arg.indexOf("--https=") > -1) {
opts.https = arg.substring(8);
process.argv.splice(i, 1);
Expand All @@ -147,7 +151,7 @@ for (var i = process.argv.length - 1; i >= 2; --i) {
process.argv.splice(i, 1);
}
else if (arg === "--help" || arg === "-h") {
console.log('Usage: live-server [-v|--version] [-h|--help] [-q|--quiet] [--port=PORT] [--host=HOST] [--open=PATH] [--no-browser] [--browser=BROWSER] [--ignore=PATH] [--ignorePattern=RGXP] [--no-css-inject] [--entry-file=PATH] [--spa] [--mount=ROUTE:PATH] [--wait=MILLISECONDS] [--htpasswd=PATH] [--cors] [--https=PATH] [--https-module=MODULE_NAME] [--proxy=PATH] [PATH]');
console.log('Usage: live-server [-v|--version] [-h|--help] [-q|--quiet] [--port=PORT] [--host=HOST] [--open=PATH] [--no-browser] [--browser=BROWSER] [--ignore=PATH] [--ignorePattern=RGXP] [--no-css-inject] [--entry-file=PATH] [--spa] [--mount=ROUTE:PATH] [--wait=MILLISECONDS] [--htpasswd=PATH] [--cors] [--isolated] [--https=PATH] [--https-module=MODULE_NAME] [--proxy=PATH] [PATH]');
process.exit();
}
else if (arg === "--test") {
Expand Down
Loading