-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·33 lines (30 loc) · 757 Bytes
/
build.sh
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
#!/bin/bash
BADFOOD_DATA=$(cat badfood_data.json | jq -c '.')
export BADFOOD_DATA
envsubst < index.pre.html > index.html
rm -rf dist/
rsync --exclude=index.pre.html \
--exclude=*.sh \
-exclude=dist/ \
--exclude=.git* \
--exclude=LICENSE \
--exclude=README.md \
--exclude=spiders/ \
--exclude=.prettierignore \
--exclude=badfood_data.json \
--exclude=requirements.txt \
--exclude=images/*.xcf \
--delete -av . dist/
prettier -w .
echo "Minifying everything we can"
find ./dist/ -type f \( \
-name "*.html" \
-o -name '*.js' \
-o -name '*.css' \
-o -name '*.svg' \
-o -name "*.xml" \
-o -name "*.json" \
-o -name "*.html" \
\) \
-and ! -name "*.min*" -print0 |
xargs -0 -n1 -P4 -I '{}' sh -c 'minify -o "{}" "{}"'