Skip to content

Commit

Permalink
Add the live-server's file option in it (#118)
Browse files Browse the repository at this point in the history
* add basic mount directories as routes support

* add file option support
  • Loading branch information
magicds authored and mxschmitt committed May 9, 2018
1 parent f2a9d76 commit 926f7f1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@
],
"additionalProperties": false,
"description": "Setup https configuration"
},
"liveServer.settings.file": {
"type": "string",
"default": "",
"description": "When set, serve this file (server root relative) for every 404 (useful for single-page applications)"
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,8 @@ export class Config {
public static get getMount(): Array<Array<string>> {
return Config.getSettings<Array<Array<string>>>('mount');
}

public static get getFile(): string {
return Config.getSettings<string>('file');
}
}
3 changes: 2 additions & 1 deletion src/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ export class Helper {
mountRule[1] = path.resolve(workspacePath, mountRule[1]);
}
});
const file = Config.getFile;
return {
port: port,
host: '0.0.0.0',
root: rootPath,
file: null,
file: file,
open: false,
https: https,
ignore: ignoreFiles,
Expand Down

0 comments on commit 926f7f1

Please sign in to comment.