webui: redefined building webui

on linux: 'make' don't build libresapi every time anymore,
it now knows when, what and how to 'build' webui

on windows: builds old style
This commit is contained in:
zeners 2016-04-30 14:21:09 +02:00
parent baf940443d
commit 0a6ae559fd
2 changed files with 113 additions and 37 deletions

View file

@ -2,7 +2,7 @@
# create webfiles from sources at compile time (works without npm/node.js)
if [ "$1" = "" ];then
if [ "$1" = "" ]; then
publicdest=../../webui
src=..
else
@ -10,34 +10,53 @@ else
src=$1/webui-src
fi
if [ -d "$publicdest" ]; then
echo remove existing $publicdest
rm $publicdest -R
if [ "$2" = "" ]; then
if [ -d "$publicdest" ]; then
echo remove existing $publicdest
rm $publicdest -R
fi
fi
echo mkdir $publicdest
mkdir $publicdest
if [ ! -d "$publicdest" ]; then
echo mkdir $publicdest
mkdir $publicdest
fi
echo building app.js
echo - copy template.js ...
cp $src/make-src/template.js $publicdest/app.js
if [ "$2" = "" ]||[ "$2" = "app.js" ]; then
echo building app.js
echo - copy template.js ...
cp $src/make-src/template.js $publicdest/app.js
for filename in $src/app/*.js; do
fname=$(basename "$filename")
fname="${fname%.*}"
echo - adding $fname ...
echo require.register\(\"$fname\", function\(exports, require, module\) { >> $publicdest/app.js
cat $filename >> $publicdest/app.js
echo >> $publicdest/app.js
echo }\)\; >> $publicdest/app.js
done
for filename in $src/app/*.js; do
fname=$(basename "$filename")
fname="${fname%.*}"
echo - adding $fname ...
echo require.register\(\"$fname\", function\(exports, require, module\) { >> $publicdest/app.js
cat $filename >> $publicdest/app.js
echo >> $publicdest/app.js
echo }\)\; >> $publicdest/app.js
done
fi
echo building app.css
cat $src/app/green-black.scss >> $publicdest/app.css
cat $src/make-src/main.css >> $publicdest/app.css
cat $src/make-src/chat.css >> $publicdest/app.css
if [ "$2" = "" ]||[ "$2" = "app.css" ]; then
echo building app.css
cat $src/app/green-black.scss >> $publicdest/app.css
cat $src/make-src/main.css >> $publicdest/app.css
cat $src/make-src/chat.css >> $publicdest/app.css
fi
echo copy index.html
cp $src/app/assets/index.html $publicdest/index.html
if [ "$2" = "" ]||[ "$2" = "index.html" ]; then
echo copy index.html
cp $src/app/assets/index.html $publicdest/index.html
fi
if [ "$2" != "" ]&&[ "$3" != "" ]; then
if [ ! -d "$3/webui" ]; then
echo mkdir $3/webui
mkdir $3/webui
fi
echo copy $2 nach $3/webui/$2
cp $publicdest/$2 $3/webui/$2
fi
echo build.sh complete