-
Notifications
You must be signed in to change notification settings - Fork 82
/
Makefile
46 lines (35 loc) · 1.67 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
.DEFAULT_GOAL := build
SHELL := /bin/bash
CSSMD5 = $(shell md5sum ./public/css/styles.css | awk '{ print $$1 }')
HUGO_VERSION=0.111.3
build: clean hugo
install:
mkdir themes
git clone https://github.com/shapeshed/tufte-catppuccin.git themes/tufte-catppuccin
wget -q "https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION)/hugo_extended_$(HUGO_VERSION)_Linux-64bit.tar.gz"
tar -xzf hugo_extended_$(HUGO_VERSION)_Linux-64bit.tar.gz
chmod +x hugo
sudo mv hugo /usr/local/bin/
clean:
@rm -Rf ./public
hugo:
@hugo
gzip-static:
@find ./public -type f \( -name "*.html" -o -name "*.css" -o -name "*.xml" \) -exec gzip -n -k -f -9 {} \;
images:
find ./ -type f -name '*.png' -exec sh -c 'avifenc --min 10 --max 30 $1 "${1%.png}.avif"' _ {} \;
find ./ -type f -name '*.jpg' -exec sh -c 'avifenc --min 10 --max 30 $1 "${1%.png}.avif"' _ {} \;
find ./ -type f -name '*.jpeg' -exec sh -c 'avifenc --min 10 --max 30 $1 "${1%.png}.avif"' _ {} \;
find ./ -type f -name '*.png' -exec sh -c 'cwebp $1 -o "${1%.jpg}.webp"' _ {} \;
find ./ -type f -name '*.jpg' -exec sh -c 'cwebp $1 -o "${1%.jpg}.webp"' _ {} \;
find ./ -type f -name '*.jpeg' -exec sh -c 'cwebp $1 -o "${1%.jpg}.webp"' _ {} \;
find ./static/images/articles -mtime -1 -name '*.png' | xargs optipng -o7 -strip all
minify-html:
@minify -r --match=\.html public -o .
css:
@mv ./public/css/styles.css ./public/css/$(CSSMD5).css
@find ./public -name index.html | xargs sed -i "s/styles\.css/$(CSSMD5)\.css/"
deploy:
hugo deploy
validate:
@html5validator --ignore --ignore-re "prefers-color-scheme|loading|text-decoration-thickness|text-underline-offset|public/examples*|public/images/articles/index.html" --root public