Reputation: 4601
I deploy my angular app to a subfolder at the server so the URL serving the app ends up as http://www.example.com/folder-name/ - which means the basehref has to be pointing to that folder at the index.html.
As a result of this fact, after running the ng build --prod
, I have to modify the generated index.html manually each and evert time so the outputted file's basehref=""
code is edited as basehref="/folder-name/'
.
Is there any way to configure thru tsc config or some other tool so this is automated in a way that when I develop locally, the index.html would still continue to be basehref=""
but when I run the ng build
with the --prod
flag, it comes out as basehref="/folder-name/"
?
Also, (this is an independent question but), is there a way to automatically FTP the contents folder to the sub-folder
of that server?
Thanks
Upvotes: 1
Views: 8350
Reputation: 13416
The cli offers an option to add the basehref during the build
ng build --base-href /folder-name/ --prod.
you can also use -bh as an alias for --base-href
Upvotes: 4