[how i generate this site]
written 12/14/2024
check out my tool, flint
Easy Peasy
It really is. Using flint, I run flint spark
. The following is the resulting output, which walks you through each step flint takes as it bundles up your static assets.
1
2 ########## ## ## ### ## ########
3 ## ## #### ## ##
4 ####### ## ## ## ## ## ##
5 ## ## ## ## ## ## ##
6 ## ## ## ## ## ## ##
7 ## ## ## ## ## ##
8 ## ######### ## #### ##
9-------------------------------------------------
10Language-Agnostic Static Sites
11-------------------------------------------------
12🔥 sparking flint
13🗃️ searching for flint.json
14🔎 parsing routes from flint.json
15🏹 making an http request to each route
16🔨 generating static html assests
17🗑️ removing ./out
18✍️ writing minified, static html to ./out
19🖌️ copying over minified, static assests from ./static
20✏️ copying over the favicon from ./favicon.ico to ./out
21⚠️ Favicon does not exist at: ./favicon.ico
22📚 your assets have been bundled at ./out
23🙏 thank you for using flint
24⭐ dont forget to give me star at: https://github.com/phillip-england/flint
Why Flint?
You see, I found myself repeating a common pattern in my web applications. I consider myself fairly effecient with Go, and I can get a web server up and running with some html pages quickly.
I don't want to be locked into a certain way of doing things.
That's why I built flint, a minimal static site generator for people who can already get their static site running on a localhost server.
Why use some big static site generator when you might not have to?
Follow Along
I can explain how flint
works, but it's probably easier if you just follow along. Below, I will walk you through how to install this website, install flint, and use flint to generate a minified, static version of this website.
Install This Website
Clone the repo:
1git clone https://github.com/phillip-england/portfolio-site
You'll need go
version 1.23.3
or later.
Once installed, cd
into the project and serve it:
1cd portfolio-site
2go run main.go
Okay, now we can leave this application running in the background.
Installing Flint
In a new terminal, clone the repo:
1git clone https://github.com/phillip-england/flint
Then install:
1cd flint
2go install
You'll need to verify go
properly installed the binary on your PATH
. After, reload your terminal to ensure the changes take effect.
To verify installation, run flint help
.
flint.json
Inside of portfolio-site
you should see a flint.json
. Go ahead and take a look:
1{
2 "host": "http://localhost:8080",
3 "static": "./static",
4 "favicon": "./favicon.ico",
5 "out": "./out",
6 "target": "https://phillip-england.com",
7 "routes": [
8 "/",
9 "/posts",
10
11 ... more routes
12 ]
13}
This config tells flint where to ping, which routes to ping, and where all the static assets are located. It also tells flint where the website will be deployed so all href
values can be changed to absolute paths pointing towards the deployment location.
Generating The Site
Navigate back to the portfolio-site
and make sure it is still running in the background on localhost:8080
.
Once you've ensured the website is still running locally, run the following command from within portfolio-site
:
1flint spark
Afterward, you should see a new directory named ./out
at /portfolio-site/out
.
This directory contains all the static assets for the site and can easily be dropped into any static deployment environment.