Phillip England
checkout my tool, flint
12/14/2024
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-------------------------------------------------
9Language-Agnostic Static Sites
10-------------------------------------------------
11🔥 sparking flint
12🗃️ searching for flint.json
13🔎 parsing routes from flint.json
14🏹 making an http request to each route
15🔨 generating static html assests
16🗑️ removing ./out
17✍️ writing minified, static html to ./out
18🖌️ copying over minified, static assests from ./static
19✏️ copying over the favicon from ./favicon.ico to ./out
20⚠️ Favicon does not exist at: ./favicon.ico
21📚 your assets have been bundled at ./out
22🙏 thank you for using flint
23⭐ dont forget to give me star at: https://github.com/phillip-england/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?
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.
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.
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.
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.
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.