-
Notifications
You must be signed in to change notification settings - Fork 6
/
make.sh
executable file
·53 lines (41 loc) · 1.17 KB
/
make.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#
# This script is based on https://guide.elm-lang.org/optimization/asset_size.html
#
set -e
ELM_MAIN=src/Main.elm
JS_TEMP=elm.tmp.js
JS_TARGET=elm.js
if [ "$1" = "" ]
then
elm make $ELM_MAIN --optimize --output=$JS_TEMP
uglifyjs $JS_TEMP --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' \
2>/dev/null | uglifyjs --mangle --output=$JS_TARGET
echo
echo "Compiled size: $(cat $JS_TEMP | wc -c) bytes"
echo "Minified size: $(cat $JS_TARGET | wc -c) bytes"
echo "Gzipped size: $(cat $JS_TARGET | gzip -c | wc -c) bytes"
rm $JS_TEMP
elif [ "$1" = "d" ]
then
elm make $ELM_MAIN --debug --output=$JS_TARGET
elif [ "$1" = "q" ]
then
elm make $ELM_MAIN --optimize --output=$JS_TARGET
elif [ "$1" = "qq" ]
then
elm make $ELM_MAIN --output=$JS_TARGET
else
echo
echo "USAGE"
echo " ./make.sh [d | q | qq]"
echo
echo "OPTIONS"
echo " d debug ; with --debug"
echo " q quick ; no minifying"
echo " qq really quick ; no minifying or --optimize"
echo
echo
echo
fi