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 image: alpine/edge
packages: packages:
- rsync - rsync
- zopfli - zopfli # for max compression with gzip_static
- brotli # for max compression with brotli_static
- git # for Hugo's gitInfo - git # for Hugo's gitInfo
- make - make
- npm # for testing with lighthouse and webhint - npm # for testing with lighthouse and webhint

12
.hintrc
View file

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

View file

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

View file

@ -63,10 +63,13 @@ test: lint-css hint-devserver check-links
.PHONY: build .PHONY: build
build: hugo build: hugo
# gzip_static + max zopfli compression # 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' \ 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 \ | grep -v gemini \
| xargs zopfli --i$(ZOPFLI_ITERATIONS) --gzip | 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 endif

View file

@ -20,7 +20,8 @@ To build:
- Hugo 0.75 or later - Hugo 0.75 or later
- Make - Make
- Git (Hugo uses Git info for features like date last updated) - 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. - POSIX utils: grep, find, etc.
To deploy: To deploy: