1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-09-19 20:02:10 +00:00

Use brotli_static with max brotli compression

Compress with brotli ahead of time in CI, just like we do with zopfli
for gzip_static

Update hintrc to check for brotli compression.

Update lighthouse config to throttle CPU some more since brotli
decompression can be heavier.
This commit is contained in:
Rohan Kumar 2020-12-30 23:43:29 -08:00
parent 2083f1aed5
commit 0c64c5867b
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
5 changed files with 10 additions and 15 deletions

View file

@ -2,7 +2,8 @@
image: alpine/edge
packages:
- rsync
- zopfli
- zopfli # for max compression with gzip_static
- brotli # for max compression with brotli_static
- git # for Hugo's gitInfo
- make
- npm # for testing with lighthouse and webhint

12
.hintrc
View file

@ -34,17 +34,7 @@
}
],
"doctype": "error",
"http-compression": [
"warning",
{
"html": {
"brotli": false
},
"resource": {
"brotli": false
}
}
],
"http-compression": "error",
"https-only": "error",
"manifest-file-extension": "error",
"manifest-is-valid": "error",

View file

@ -56,7 +56,7 @@ ci:
- offline-start-url
- offscreen-images
throttling:
cpuSlowdownMultiplier: 3.4 # seems about right on builds.sr.ht
cpuSlowdownMultiplier: 4.2 # seems about right on builds.sr.ht
throttlingMethod: devtools
url:
- https://staging.seirdy.one/

View file

@ -63,10 +63,13 @@ test: lint-css hint-devserver check-links
.PHONY: build
build: hugo
# gzip_static + max zopfli compression
ifndef NO_GZIP_STATIC
ifndef NO_STATIC
find $(OUTPUT_DIR) -type f -name '*.html' -o -name '*.css' -o -name '*.xml' -o -name '*.txt' -o -name '*.asc' -o -name '*.webmanifest' \
| grep -v gemini \
| xargs zopfli --i$(ZOPFLI_ITERATIONS) --gzip
find $(OUTPUT_DIR) -type f -name '*.html' -o -name '*.css' -o -name '*.xml' -o -name '*.txt' -o -name '*.asc' -o -name '*.webmanifest' \
| grep -v gemini \
| xargs brotli -q 11
endif

View file

@ -20,7 +20,8 @@ To build:
- Hugo 0.75 or later
- Make
- Git (Hugo uses Git info for features like date last updated)
- Zopfli (optional; set `NO_GZIP_STATIC=1` to disable)
- Zopfli (optional; set `NO_STATIC=1` to disable)
- Brotli (optional; set `NO_STATIC=1` to disable)
- POSIX utils: grep, find, etc.
To deploy: