build: replace minipack shell script with sed commands

This commit is contained in:
mappu 2017-10-28 11:51:23 +13:00
parent a109e2dc29
commit 41e244c255
2 changed files with 4 additions and 25 deletions

View File

@ -33,10 +33,11 @@ bindata.go: client client/*
cp -r ./client ./clientpack cp -r ./client ./clientpack
( echo ';(function() {' ; cat clientpack/dcwebui.js ; echo '})();' ) | uglifyjs -o clientpack/dcwebui.min.js -c -m --ie8 ( echo ';(function() {' ; cat clientpack/dcwebui.js ; echo '})();' ) | uglifyjs -o clientpack/dcwebui.min.js -c -m --ie8
lessc --clean-css clientpack/dcwebui.css clientpack/dcwebui.min.css lessc --clean-css clientpack/dcwebui.css clientpack/dcwebui.min.css
#./minipack style dcwebui.css clientpack/dcwebui.min.css
cat clientpack/index.htm \ cat clientpack/index.htm \
| ./minipack style dcwebui.css clientpack/dcwebui.min.css \ | sed -e '/dcwebui.css/{i <style>' -e 'r clientpack/dcwebui.min.css' -e 'a </style>' -e 'd}' \
| ./minipack script dcwebui.js clientpack/dcwebui.min.js \ | sed -e '/dcwebui.js/{i <script>' -e 'r clientpack/dcwebui.min.js' -e 'a </script>' -e 'd}' \
| ./minipack script socket.io-1.7.2.js clientpack/socket.io-1.7.2.js \ | sed -e '/socket.io-1.7.2.js/{i <script>' -e 'r clientpack/socket.io-1.7.2.js' -e 'a </script>' -e 'd}' \
> clientpack/index.packed.htm > clientpack/index.packed.htm
mv clientpack/index.packed.htm clientpack/index.htm mv clientpack/index.packed.htm clientpack/index.htm
html-minifier --collapse-whitespace -o clientpack/index.min.htm clientpack/index.htm html-minifier --collapse-whitespace -o clientpack/index.min.htm clientpack/index.htm

View File

@ -1,22 +0,0 @@
#!/bin/bash
set -eu
embed() {
local tag="$1"
local find="$2"
local sourcefile="$3"
while IFS= read -r line ; do
if [[ "${line}" =~ "${find}" ]] ; then
echo -n "<${tag}>"
cat "${sourcefile}"
echo -n "</${tag}>"
else
echo "${line}"
fi
done
}
embed "$@"