Skip to content

Commit 7a92b06

Browse files
committed
Rename --path option for ng serve command to --base-href (alias --bh). This option now also sets the base-href tag in index.html to match the virtual path.
1 parent 1c37fa9 commit 7a92b06

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/angular-cli/commands/serve.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface ServeTaskOptions {
2727
sslCert?: string;
2828
aot?: boolean;
2929
open?: boolean;
30-
path?: string;
30+
baseHref?: string;
3131
}
3232

3333
const ServeCommand = Command.extend({
@@ -89,12 +89,12 @@ const ServeCommand = Command.extend({
8989
aliases: ['o'],
9090
description: 'Opens the url in default browser',
9191
},
92-
{
93-
name: 'path',
92+
{ name: 'base-href',
9493
type: String,
95-
default: '/',
94+
default: null,
95+
aliases: ['bh'],
9696
description: 'makes the content available on path e.g. http://host:port/path'
97-
},
97+
}
9898
],
9999

100100
run: function(commandOptions: ServeTaskOptions) {

packages/angular-cli/tasks/serve-webpack.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default Task.extend({
2525
commandOptions.target,
2626
commandOptions.environment,
2727
undefined,
28-
undefined,
28+
commandOptions.baseHref,
2929
commandOptions.aot
3030
).config;
3131

@@ -71,7 +71,7 @@ export default Task.extend({
7171
`./${CliConfig.fromProject().config.apps[0].root}`
7272
),
7373
historyApiFallback: {
74-
index: commandOptions.path,
74+
index: commandOptions.baseHref,
7575
disableDotRule: true
7676
},
7777
stats: webpackDevServerOutputOptions,
@@ -82,7 +82,7 @@ export default Task.extend({
8282
poll: CliConfig.fromProject().config.defaults.poll
8383
},
8484
https: commandOptions.ssl,
85-
publicPath: commandOptions.path
85+
publicPath: commandOptions.baseHref
8686
};
8787

8888
if (sslKey != null && sslCert != null) {

0 commit comments

Comments
 (0)