deploying angular project localy and on github pages

Discussão em 'Angular' iniciado por Pferdesalbe, Setembro 12, 2024.

  1. Pferdesalbe

    Pferdesalbe Guest

    I'm have written some small angular projects. Now the next step is to build / deploy them. I have never build / deployed a project before.

    Now my first try was the following commands:

    ng build


    All tests are ok, and angular generated a new /dist directory in my project. path:


    ~/FrontendMentor/contact-form-main/contact-form-angular/dist/contact-form-angular/browser/
    ​

    If I open the index.html in a browser i just see a colored page. After inspecting the html file, all needed ressources are not found, although they are in the correct directory. Why does this happen and how to solve this?

    The next problem which appears, how could this be shown on my github page? A simple html site seems to be no problem, but the angular project leads to the same issue like on my local machine (paths are not correct). The directory FrontendMentor is a git direcotry and on my github profile FrontendMentor is the repository.

    ng build --configuration production --base-href /FrontendMentor/contact-form-main/contact-form-angular/
    git add .
    git commit -m ""
    git push


    Repository: https://github.com/HartmannsgruberBen/FrontendMentor

    Github Pages: https://hartmannsgruberben.github.io/FrontendMentor/

    I have no idea how to solve this, please help me.

    Continue reading...

Compartilhe esta Página