https://stackoverflow.com/questions/51182322/whats-the-difference-between-base-href-and-deploy-url-parameters-of-angular
- Base-href is being used by routing
- deploy-url is for assets.
In most cases base-href is enough.
Scss is ok with relative path like ../../../ because is pre-packaged and determined using web -pack, but html is not
assets path not changed even with --deploy-url
https://github.com/angular/angular-cli/issues/9835
https://stackoverflow.com/questions/54671587/angular-deployment-assets-path
https://infinum.com/handbook/frontend/angular/angular-guidelines-and-best-practices/assets-and-caching
because /assets/ means starting from rooot, will not impacted by --deploy-url
change path to :
assets/
Fast foward to 2022, my problem and solution is as following:
Wrong way: using "../assets/something.png" or "../../assets/something.png" works fine with ng serve, but not with ng build, like this
<img src="../assets/something.png>
Right way: easily using "asset/someting.png" works fine with both ng serve and ng build, like this
<img src="assets/something.png>
No comments:
Post a Comment