forked from kallaballa/Poppy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_web.sh
executable file
·26 lines (18 loc) · 905 Bytes
/
make_web.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
#!/bin/bash
function red { echo -ne "\033[1;31m$1\033[0m"; tput sgr0; }
set -e
#rm -r web/
mkdir -p web
echo "The content of this directory is generated by the makeweb.sh script. All changes in this directory might get lost!" > web/README
SEDSTR='s#poppy.worker.js#./get.php?res=poppy.worker.js#g;s#poppy.wasm#./get.php?res=poppy.wasm#g;s#poppy.data#./get.php?res=poppy.data#g;'
make clean;
AUTOVECTOR=1 WASM=1 make -j shrink; sed -i "$SEDSTR" src/poppy.js;
cp -r src/img src/index.php src/get.php src/poppy.html src/poppy-custom.js src/poppy.js src/poppy.wasm src/poppy.data src/poppy.worker.js src/cropper.min.* web/
#precompress the main resources
for file in web/poppy.html web/poppy.js web/poppy.wasm web/poppy.data web/poppy.worker.js web/poppy-custom.js web/cropper.min.js; do
gzip -9 $file; mv $file.gz $file;
done
rm -f poppyweb.zip
cd web/
zip -r ../poppyweb.zip *
red "Success\n"