1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Images are not loading after deploying angular app on github pages

Discussão em 'Angular' iniciado por hdw3, Outubro 1, 2024.

  1. hdw3

    hdw3 Guest

    I deployed a test project on github pages using these commands:

    ng build --prod --base-href https://<profile_name>.github.io/<repo_name>/
    ngh --dir=dist/scrabble


    Everything works fine except images (on localhost every image is loading). outputPath in angular.json:

    "outputPath": "dist/scrabble/",


    assets in angular.json:

    "assets": [
    "src/favicon.ico",
    "src/assets"
    ],


    assets folder with images is located in <project_folder>/src/assets

    one example of image tag which works perfectly on localhost but doesn't load on github pages:

    <img src="../../../assets/scaledlogo.png" routerLink="/menu" />

    Continue reading...

Compartilhe esta Página