-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcalculate-sizes
More file actions
executable file
·28 lines (20 loc) · 748 Bytes
/
Copy pathcalculate-sizes
File metadata and controls
executable file
·28 lines (20 loc) · 748 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
#!/usr/bin/env bash
DIR=$(dirname "$(realpath "$0")")
FILES=$(ls "$DIR/dist/"*.js)
echo "| Item | minified (terser) | minified + gzipped |"
echo "|--------------------------------|-----------------------|-----------------------|"
for FILE in $FILES; do
BASENAME=$(basename "$FILE" .js)
MINIFIED="$DIR/dist/$BASENAME.js.min"
ZIPPED="$DIR/dist/$BASENAME.js.gz"
terser --module --rename "$FILE" >"$MINIFIED"
gzip -c "$MINIFIED" >"$ZIPPED"
PADDING=' '
if [[ "$BASENAME" == 'scroll-snap-slider' ]]; then
PADDING="\t"
fi
echo -e "| $BASENAME$PADDING\t | $(gstat --printf="%s" "$MINIFIED") B \t\t | $(gstat --printf="%s" "$ZIPPED") B \t\t |"
rm "$MINIFIED"
rm "$ZIPPED"
done
echo -e "\n"