-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using deploy-url and base-href yields in wrong assets path #6730
Comments
In regards to deployment, using Regardless, you are correct that the asset path should not be |
I just had the exact problem as described by @schmitch. Instead of url("/assets/images/bg.png"), try to use the ../ so something like url("../../../assets/images/bg.png") depending on however many directories up the assets folder is. In response to @clydin: I don't experience what you describe with --base-href and --deploy-url. If I just use --base-href by itself then none of my js resources get loaded up because they're trying to be loaded from / instead of /ui/ |
I have same problem as @schmitch So I end with wrong urls in css |
#6320 may have fixed this case, it's release in |
In my case I used it with |
@filipesilva i am still having this issue with ng build --base-href /test/ --deploy-url /test/. When i deploy to the server, assets path is falling back to root of the server and failing lo load. I followed the reference #6320 you have given, still having the same issue |
@clydin can you take a look please? |
We are having the same problem with |
Guys, this is important for us. You built an app, you deploy it and you can't show it to a client because of this! The app seem completely broken to a client! |
Latest update might fix my deployment issue: angular/angular-cli#6730 Funny stuff here. Error on ng serve: https://puu.sh/yJxDb/00ca4e862d.png Solution here: https://puu.sh/yJxDS/194cdea151.png WTF!
Changing to relative paths fixed this for me when doing a prod build with a specified
to
|
Is this fixed for images in html? And the image tag remains the same with nothing added to the start. Is this correct? |
|
I was having the same problem with getting my css /* src/app/app.component.css */
.app {
background: url('../assets/background.jpg');
} to correctly resolve when hosted as a GitHub Project Page (keego.github.io/angular-test-app). I was using
All of which produced weird results:
instead of the desired:
I finally got the path to resolve correctly by including trailing slashes to the paths in the combined with the original asset path: |
Is this is still not solved? I'm using angular cli 6.2.3, ng build with the base-href. For example |
Still having the same issue, deploying the assets over iis with a deploy script; My current workaround is to use the site base url and create a file on the root of the project. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Versions.
@angular/cli: 1.1.1
node: 8.1.1
os: darwin x64
Repro steps.
create a new application and use a
--base-href=/ui/
and--deploy-url=/ui/
while having a stylesheet of:The output will then be
.login-body{background:transparent url(/ui/ui/assets/images/bg.png) no-repeat scroll 0 0/cover}
in both,build --prod --deploy-url=/ui/ --base-href=/ui/
and onserve --deploy-url=/ui/ --base-href=/ui/
Mention any other details that might be useful.
Actually if I remove one of the things either
base-href
anddeploy-url
it would work, however if I omitbase-href
routing will actually re-initialize the application everytime I open a[href]
orng-href
link (hybrid app). if I omitdeploy-url
i will get 404 well I might make it work without deploy-url since I proxy the ng serve in my application and I can strip the path, but I still think that setting both shouldn't end in a assets path of/ui/ui/
.What's even more strange is that the
$icon-font-path
and$fa-font-path
of font-awesome and boostrap are working correctly and don't double add a/ui/
Basically I think that without
--deploy-url
I can fully use my application since angular-cli omits relative url's so the script path isui/...
. However it would've been great to use absolute-urls for everything which I can enforce with--deploy-url
.The text was updated successfully, but these errors were encountered: