Using NPM to specify base-href
When building an Angular application, people usually use "ng" and pass arguments to that invocation.
Typically, when wanting to hard code "base-href" in "index.html", one will issue:
ng build --base-href='https://ngx.rktmb.org/foo'
I used to build my angular apps through Bamboo or Jenkins and they have a "npm" plugin.
I got the habit to build the application with "npm run build" before deploying it.
But the development team once asked me to set the "--base-href='https://ngx.rktmb.org/foo'" parameter.
npm run build --base-href='https://ngx.rktmb.org/foo
did not set the base href in indext.html
After looking for a while, I found https://github.com/angular/angular-cli/issues/13560 where it says:
You need to use −− to pass arguments to npm scripts.This did the job!
The command to issue is then:
npm run build -- --base-href='https://ngx.rktmb.org/foo'