Dustin Ruetz's website.
- Prerequisite: Have mkcert installed.
- From the root of the repo, run the following commands 1) to create the
./ssl/
directory, and 2) to generate certificate and key files for the local development domain. (ℹ️ Note:./ssl/
is listed in.gitignore
to keep these files out of version control.)
mkdir ./ssl/
mkcert -cert-file ./ssl/public.cert -key-file ./ssl/private.key development.dustinruetz.com
- Add the following line to your
hosts
file:127.0.0.1 development.dustinruetz.com
From the root of the repo use npm run dev
to start the development servers (i.e. local and network).
From the root of the repo use npm run build
to compile the site to the ./www/
output directory of static files. (ℹ️ Note: ./www/
is listed in .gitignore
to keep these files out of version control.)
The repo is configured so that the www
branch is a Git worktree that tracks the ./www/
directory; GitHub Pages hosts the site's files by sourcing from this branch. Continuous deployment/integration is handled by the build
GitHub Action; the site is compiled and deployed every time a commit is pushed to the main
branch.
- Managing a custom domain for your GitHub Pages site (especially the configuring a subdomain and configuring an apex domain sections)
- ℹ️ Note: To enable secure redirects (from the apex domain with no protocol/subdomain/
http
/http://www
/www
tohttps://www
) it's important that the build script copy the CNAME file (with a value ofwww.dustinruetz.com
) to the root of the output directory. - Using git worktree to deploy GitHub Pages
- Search "{name of domain registrar} DNS record types" for detailed documentation on how to configure the A and CNAME records.
- Configure four A records, one for each of GitHub Pages' four IP addresses; "host" is
@
, "value" is the IP address.- ℹ️ Note: An A record (Address record) associates an apex domain with an IPv4 address.
- Configure one CNAME record; "host" is
www
, "value" isdustin-ruetz.github.io
.- ℹ️ Note: A trailing period (".") may be automatically appended to the CNAME domain value; this syntax is valid.
- Attempting to
require()
a string variable causes Pug/Webpack to throw an error, but requiring a template literal (specifically a string literal containing an embedded expression) works. Example:- ❌ Doesn't work:
require(imageFilename)
- ✅ Does work:
require(`./images/${imageFilename}`)
- ❌ Doesn't work:
- Use Pug's buffered code feature in combination with
JSON.stringify()
if you need to print out some data in a Pug template file. Example:
- const content = {title: "The page title", description: "The page description"}
div= JSON.stringify(content)
- Use the
!{variable}
syntax (i.e. the Pug interpolation feature) to buffer unescaped values into your template files. This is useful when combined with Webpack's Asset Modules to output SVG code directly into the compiled HTML. Example:
- const icon = require("./icons/icon.svg")
//- this will output the icon.svg code as an <svg/> HTML element
figure
| !{icon}
- Sass implementations don't provide URL rewriting, and this issue also applies to Webpack's sass-loader. Use Webpack's resolve-url-loader to solve this issue, which rewrites relative paths in
url()
statements relative to the original source file; this is useful when loading fonts via CSS.