<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Thalal Naathir Nawas on Medium]]></title>
        <description><![CDATA[Stories by Thalal Naathir Nawas on Medium]]></description>
        <link>https://medium.com/@thalal.naathir.nawas?source=rss-40e31c2fba89------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*C7w_gCxojYs67Q2U</url>
            <title>Stories by Thalal Naathir Nawas on Medium</title>
            <link>https://medium.com/@thalal.naathir.nawas?source=rss-40e31c2fba89------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 13:22:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thalal.naathir.nawas/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Step-by-Step Guide to Publishing Your Angular Project on GitHub Pages]]></title>
            <link>https://medium.com/@thalal.naathir.nawas/step-by-step-guide-to-publishing-your-angular-project-on-github-pages-848b7b1d372?source=rss-40e31c2fba89------2</link>
            <guid isPermaLink="false">https://medium.com/p/848b7b1d372</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[github-pages]]></category>
            <dc:creator><![CDATA[Thalal Naathir Nawas]]></dc:creator>
            <pubDate>Fri, 05 May 2023 19:39:07 GMT</pubDate>
            <atom:updated>2023-05-05T19:39:07.864Z</atom:updated>
            <content:encoded><![CDATA[<p><em>GitHub Pages is a free static site hosting service provided by GitHub, using which developers can create portfolios showcasing their skills through their projects.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_D2C7f7e-MLLLlRN-E4KMA.png" /><figcaption>From GitHub Pages</figcaption></figure><p><strong>Why GitHub Pages?</strong></p><ol><li>Free hosting &amp; easy to use.</li><li>Integrated with Git version control system making code tracking and collaboration much easier.</li><li>A platform to showcase your work. This helps you to stand out in the job market.</li></ol><p><strong>Where do GitHub Pages find their source from?</strong></p><p>GitHub Pages publishes a static website based on your repository. This can be done in two ways.</p><p><strong><em>Publish directly from your GitHub Repository — </em></strong>this means that you can create your website’s files (HTML, CSS, JavaScript, images, etc.) on your local machine and then push them to your GitHub repository. Once the files are in your repository, GitHub Pages can take those files and serve them as a website accessible to anyone with an internet connection.</p><p><strong><em>Runs the files through a build process and publishes a website — </em></strong>which means that you can optimize your code and create a production-ready version of your website. Once you have a build process set up, GitHub Pages can automatically run it whenever you push changes to your repository, ensuring that <strong>your website is always up-to-date with your latest code changes</strong>.</p><blockquote>We’ll be looking at publishing a website from running through a build process for an Angular Project.</blockquote><p><strong>Whose domain?</strong></p><p>You can host your site on GitHub’s &lt;username&gt;.github.io default domain or your <a href="https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site"><strong><em>custom domain</em></strong></a><strong>.</strong></p><blockquote>If you are using the default domain the URL to your site will be in this format - http(s)://&lt;username&gt;.github.io/&lt;repository&gt;</blockquote><p><strong>Can we host full-stack projects with a backend database?</strong></p><p>Unfortunately, that is not possible. As mentioned in the introduction GitHub Pages is designed to host static websites, hence it only supports static content. It is not possible to run server-side code or execute database queries on GitHub Pages. Additionally, GitHub Pages has limited storage and bandwidth, which means that it is not intended for hosting large, data-driven applications.</p><p>There are other hosting options available, such as <a href="https://www.netlify.com/"><em>Netlify</em></a> and <a href="https://www.heroku.com/"><em>Heroku</em></a>, in case you want to host a full-stack project with languages and frameworks like PHP, MySQL, Laravel, Node.js, and Spring Boot. You can also try cloud services like Amazon Web Services (AWS), Microsoft Azure, or Google Cloud Platform (GCP), where you can use their starter’s free credits to host your project for free.</p><p><strong>Let&#39;s Get Started</strong></p><p><em>Create a new Angular project</em></p><blockquote>I will be using Angular CLI 14.2.11, Node 16.20.0, and Package Manager npm 8.19.4. Extra tip — you can use Node Version Manager to manage multiple versions easily.</blockquote><p>ng new &lt;project-name&gt;— Angular CLI command to create an Angular project.</p><p>cd &lt;project-name&gt; — move into your project location.</p><p>ng serve — command to build the application and start the development server.</p><p>http://localhost:4200 will run your application if the port 4200 is not in use.</p><p><em>Create a production-ready version of the Angular project</em></p><p>We can run the ng build command without specifying the output directory, and this will store the generated output files in the default directory called dist . However, GitHub Pages requires that the files be stored in the root directory or in a docs directory. So, Locate outputPath in angular.json file to change the output path of the build files to docs.</p><pre>&quot;options&quot;: {<br>  &quot;outputPath&quot;: &quot;docs&quot;,<br>  &quot;index&quot;: &quot;src/index.html&quot;,<br>  &quot;main&quot;: &quot;src/main.ts&quot;,<br>  &quot;polyfills&quot;: &quot;src/polyfills.ts&quot;,<br>  &quot;tsConfig&quot;: &quot;tsconfig.app.json&quot;,<br>  &quot;assets&quot;: [<br>    &quot;src/favicon.ico&quot;,<br>    &quot;src/assets&quot;<br>  ],<br>  &quot;styles&quot;: [<br>    &quot;src/styles.css&quot;<br>  ],<br>  &quot;scripts&quot;: []<br>}</pre><p>ng build --output-path &lt;outputPath&gt; --base-href &lt;project-name&gt;</p><blockquote>ng build --output-path docs --base-href github-angular-project — this is how my CLI command to build and configure the settings for project deployment will look like.</blockquote><p>ng build — this command is used to build an Angular project. It compiles the project’s TypeScript code into JavaScript and bundles the project’s HTML and CSS into static files that can be served by a web server.</p><p>--output-path docs — this option specifies the output directory for the build files. In this case, the build files will be output to a directory called docs instead of the default dist directory.</p><p>--base-href &lt;project-name&gt; — this option specifies the base URL for the project. It sets the base element in the index.html file to point to the subdirectory you set, &lt;project-name&gt;. This is useful when deploying the project to a subdirectory on a web server or static hosting service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*NCuRlwDsQcLrlh9D9jtZZg.png" /><figcaption>Production Complete</figcaption></figure><blockquote>ls — run this command to list out the files and you will see the new folder, <em>docs</em> with the build files.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i3fejYEJ8blSOsWxAUs6Cg.png" /><figcaption>Contents of github-angular-project</figcaption></figure><p><em>Create a public repository</em></p><blockquote>GitHub Pages are designed to host public-facing websites and content, so it only works with public repositories.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*Ov7MlpA9Y-EbEqoYN6_F3w.png" /><figcaption>Creating a Public Repository</figcaption></figure><p>Give a suitable name to your repository. Once your repository has been created, find the HTTPS link to your repository and copy it to your clipboard.</p><p>https://github.com/&lt;username&gt;/&lt;repository&gt;.git — It will be in this format.</p><p><em>Add the Angular Project to the Repository</em></p><blockquote>Type these commands in the terminal opened from your project’s directory.</blockquote><ol><li>git init — this initializes a new Git repository. When you run this command in a directory, Git creates a new .git subdirectory in that directory, which contains the necessary files and metadata for Git to start tracking changes in your project.</li><li>git branch —this will list down all the branches and the branch you are currently working on. If you are in *master branch do step 3.</li><li>git branch -M main — this is useful when you want to rename the default branch in your Git repository from master to main .</li><li>git remote add origin https://github.com/&lt;username&gt;/&lt;repository&gt;.git — paste the link to your repository over here. With this command you are telling Git to add a remote repository named origin with the specified URL, which is the location where you want to push your changes to.</li><li>git status — this will specify the Changes not staged for commit and Untracked files .</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*i7MnH4J1HpzD4KzA2vxdFA.png" /></figure><blockquote>The changes we made in angular.json and the addition of docs with the build files are yet to be committed.</blockquote><p>6. git add . — you’re telling Git to stage all changes in the current directory and its subdirectories.</p><p>7. git commit -m &quot;&lt;commit message&gt;&quot; — you’re creating a new commit with the changes that you’ve staged using git add and including a commit message that describes the changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*jAIrwUkTqIqm7vUph-mxzg.png" /></figure><p>8. git push -u origin main — you’re pushing the changes in your local main branch to the main branch on the remote repository named origin. The -u option sets the upstream branch to origin/main, so you can use git push in the future to push changes to the same branch on the remote repository without having to specify the branch name.</p><p>Note that it will prompt you to enter your GitHub credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*XGOiqcolIFTe-7ddLGAgBQ.png" /><figcaption>Authentication Failed</figcaption></figure><p>This is because you will have to enter one of your generated <a href="https://github.com/settings/tokens"><strong><em>personal access tokens</em></strong></a> when prompted to enter the GitHub password. Then you will be able to successfully push the local branch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*3UulQELKJonU-BPUIYiN5g.png" /></figure><p>9. Go to the repository settings and locate the pages tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sNTAxNImmiUAD4e1shelSg.png" /></figure><p>10. Choose main for the branch, select /docs for the folder and then save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*9dK9oZfquUWInfj6brJmzQ.png" /></figure><p>https://&lt;username&gt;.github.io/&lt;repository&gt; — your website will be published with this URL format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M9WusfLJXVK8u2M9vCTxLg.png" /><figcaption>My Angular app published on https://itsmyblackaxe.github.io/github-angular-project</figcaption></figure><p><em>Checking the Deployment history</em></p><p>https://github.com/&lt;username&gt;/&lt;repository&gt;/deployments — over here you can check the commit that was deployed, the date and time of the deployment, and the status of the deployment (whether it was successful or not). If the deployment was unsuccessful, you can click on the View logs button to view the deployment logs and troubleshoot any issues.</p><p><em>Publishing changes made to the code</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-0eVLrQhDf9JFCfQsVJ3jA.png" /><figcaption>Changes made to <em>github-angular-project</em></figcaption></figure><p>Re-build your project with the same command as before</p><p>ng build --output-path docs --base-href &lt;project-name&gt;</p><p>Run git status to see the unstaged changes and untracked files.</p><p>Run git add . , git commit -m &quot;&lt;commit message&gt;&quot; , and git push .</p><p>Go to the Deployment page to view the status of the current commit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YVcjGHoeSv1i8mwwi4NFDg.png" /><figcaption>Latest commit deployment is currently pending</figcaption></figure><p>Reload the Deployment page to see the current status. Wait for it to change to active . Reload the website and changes must have been published. Sometimes it can take up to 10 minutes to publish the changes even after your latest deployment status has become active .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ShrifqyWa8Wrrvp7qmr4aA.png" /><figcaption>Changes have been published</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=848b7b1d372" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>