-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathcompress
More file actions
executable file
·38 lines (27 loc) · 819 Bytes
/
compress
File metadata and controls
executable file
·38 lines (27 loc) · 819 Bytes
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
#!/usr/bin/env bash
# https://github.com/google/zopfli
declare -r \
DIST=./dist \
ZOPFLI='zopfli -v -i1' \
BROTLI='brotli --verbose --best'
# bro is installed locally and manually. No npm cli. HELP!
declare -ar \
FILES=( snuggsi.min.es snuggsi.min.js )
echo -e " 🌱 Compressing …"
for file in ${FILES[@]} ; do
declare path=${DIST}/${file}
echo " 🌿 $path"
echo " 🍃 Brotli 👉 ${path}.br"
$BROTLI --stdout \
$path > $path.br
# https://www.ietf.org/rfc/rfc1951.txt
echo " 🍂 DEFLATE 👉 $path.deflate"
$ZOPFLI --deflate $path
# https://www.ietf.org/rfc/rfc1950.txt
echo " ☘️ ZLIB 👉 ${path}.zlib"
$ZOPFLI --zlib $path
# https://www.ietf.org/rfc/rfc1952.txt
echo " 🍀 GZIP 👉 ${path}.gz"
$ZOPFLI --gzip $path
echo
done