I wanted a simple personal website and decided to do a static site, just like in the good old days. It has however some modern twists. Since this is just a personal web page, the focus was on the things I like, for example getting a 100 % Lighthouse report and hosting it for free.
The HTML and CSS is just hand coded, no frameworks or anything. The sitemap.xml is hand coded too, it's just one record in it. The images are optimised manually beforehand, no fancy image tools here.
Getting a 100 % Lighthouse report was actually not that easy, not to my knowledge at that time. I learnt about async scripts, 'defer', contentful paints, cache policies and how to tackle fonts that are not loaded yet, and a lot of SEO stuff
I guess inlining the images, like base 64 encoding them and doing the same with the font could increase the performance more, but I still got 100 % without doing that.
Hosted on Firebase
The site is hosted on Firebase, Google's cloud platform. It is designed to host sites that uses other Firebase functionality, but it is really easy to setup to host simple HTML, CSS and other static material. It is also free and distributes content onto a CDN for fast performance. There are other hosting providers that also provides a free tier, but I chose Firebase because it includes support for custom domains even in its free tier. Edit: Google has now added some limitations to the free plan.
- Install the Firebase CLI (`curl -sL https://firebase.tools | bash`)
- `firebase init hosting`
- Create a new project or use an old one
- Select your build output folder as public directory, probably `/dist` or similar
- `firebase deploy`
Yes, it's that easy.
Firebase supports custom domains, just go to https://console.firebase.google.com/ and enter the project you created. Click on Hosting to the right and then "Add custom domain". You can also configure redirects here, like redirecting people entering your domain with www to without www.
Grunt scripts that makes magic
The following grunt packages are used: