-
Notifications
You must be signed in to change notification settings - Fork 0
/
optimize.sh
executable file
·33 lines (24 loc) · 1.03 KB
/
optimize.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
#!/usr/bin/env bash
# From https://guide.elm-lang.org/optimization/asset_size.html
set -e
js="app.js"
min="public/app.min.js"
elm make --optimize --output=$js "$@"
mkdir -p public
uglifyjs $js --compress 'pure_funcs=[F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9],pure_getters,keep_fargs=false,unsafe_comps,unsafe' | uglifyjs --mangle --output $min
echo "Compiled size: $(wc $js -c) bytes ($js)"
echo "Minified size: $(wc $min -c) bytes ($min)"
echo "Gzipped size: $(gzip $min -c | wc -c) bytes"
npm run css-build:prod
mkdir -p public/img public/pdf
cp -r img/128px_v2 public/img/
cp -r pdf public/
cp img/favicon.ico img/*.png public/img/
sed "s#../css/app.css#app.min.css#; s/app.js/app.min.js/; s/YOUR_PROJECT_ID/$SWETRIX_PROJECT_ID/; s/disabled: *true/disabled: false/" index.html > public/index.html
echo "google-site-verification: google$GOOGLE_SITE_VERIFICATION.html" > "public/google$GOOGLE_SITE_VERIFICATION.html"
cat << EOF > "public/BingSiteAuth.xml"
<?xml version="1.0"?>
<users>
<user>$BING_SITE_VERIFICATION</user>
</users>
EOF