How to deploy angular app on GitHub Pages for free

In this blog post, we are going to discuss about “how we can deploy an angular app on GitHub Pages for free”

To discuss further, lets create a angular application using the Angular CLI. You can checkout one of our detailed post on how to create angular app using CLI here.

Create an angular application using angular CLI

The flow is we are going to generate an angular app using angular CLI. The CLI will generate us a sample application and we will push that boilerplate into GitHub with a new repo.

And then we will look into the steps to deploy that application in github pages.

Create GitHub Repository

I’m going to create an repository with a name “angular-hosting-demo”

Github Repo

Once I create repo, I’m going to push all codes here.

New application using Angular CLI

By generating following after installing all the necessary tools.

ng new <name> [options]

ng new angular-hosting-demo

It will generate an application with following folder structure.

File structure

Verify whether application is building and showing output using following command

ng serve

And it will show us the following output

localhost app

Now into action

For this we are going to install an npm package.

Add angular-cli-ghpages to your project

Run the following command to add angular-cli-ghpages

ng add angular-cli-ghpages

You have run the above from the home directory or root directory of your project.

It will update the angular.json file in your repository.

Now commit all your changes to remote branch.

Deploy your project to GitHub pages

Deploy your project to GitHub pages with all default settings. Your project will be automatically built in production mode.

ng deploy --base-href=/<repositoryname>/

Please be aware of the –base-href option. It is necessary when your project will be deployed to a non-root folder.

In our case, we will run the following command to deploy the application with repo name as bas-href value

ng deploy --base-href=angular-hosting-demo

And this built code will uploaded into separate branch called gh-pages

And it will have runtime files as below

deployed code

And base-href would have details of repository name

<!doctype html>
<html lang="en">
  <meta charset="utf-8">
  <base href="angular-hosting-demo">  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles.09e2c710755c8867a460.css"></head>
<script src="runtime-es2015.0dae8cbc97194c7caed4.js" type="module"></script><script src="runtime-es5.0dae8cbc97194c7caed4.js" nomodule defer></script><script src="polyfills-es5.177e85a9724683782539.js" nomodule defer></script><script src="polyfills-es2015.f332a089ad1600448873.js" type="module"></script><script src="main-es2015.48f00976eb36d615f1e8.js" type="module"></script><script src="main-es5.48f00976eb36d615f1e8.js" nomodule defer></script></body>

Access deployed site

To get the URL, you can visit the settings page. It will provide the details of hosted application under github pages tab

Now, we can access the deployed site in the following URL

Thats it!

Give it a try, and leave your feedbacks in comment section below.

Daily journal for 30 days

πŸ“Œ Daily journal

Let’s talk about daily journal in personal life.

There are lots of things to journal in day to day life.

πŸ’‘ Health journal
πŸ’‘ Sleep – Wakeup time journal
πŸ’‘ Habit tracker journal
πŸ’‘ Bullet journal

Journal is nothing but tracking something on daily basis.

I follow bullet journal to keep track of the

🍾 to do list of day
🍾 progress of short/weekly goals
🍾 priority task of the day

The key benefits of the journal is stay focused on what we to do, and decide & plan the day well ahead.

Marking a checklist done makes you happy βœ”

Just spend a 10 minutes a day to prepare & plan for the day.

And take some time to update metrics at end of the day or may be mid of the day.

Important question I have in my journal is

Am I happy today πŸ₯³ or not πŸ˜”

Track for 30 days and see how many days you’re happy πŸ“…

The main things you will unlock for tracking your habits or task is patterns.

Like which day in week, you are productive.

What makes you feel happy. How structured and discipline you’re in planning and maintain records. πŸ’½

Patterns will break & intro you many data of yours.

Sometimes you’ll do it for 2 days. And drop it.

Then after sometime you’ll do for week & stop. πŸ₯Š

For better clarity of dat, I suggest one to track your personal achievements & tasks for 30 days.

So that you could reach good amount of data & Journal will become your habit.

And also you can add a small summary daily you wish.

During month end, you can review your whole month and read your writing ✍️

It will be interesting, give a try.

πŸ†“ ideas

You can some questions in your journal template

What makes my day very happy?
What drained my energy today?
Is it same sh*t, different day?

You can use some online tools πŸ₯… or some note books πŸ“š to track.

It’s up to individuals 🀞

Cheers 🍻πŸ₯‚