gateway.fjla.uk/old/deploy/deploy.sh

38 lines
1.1 KiB
Bash
Raw Normal View History

2023-02-16 19:57:13 +00:00
#!/bin/bash
ROOTIN="/data/in"
ROOTOUT="/data/out"
echo "Running UglifyJS on /data/in folder"
uglifyjs-folder "$ROOTIN" -x ".js" -eo "$ROOTOUT"
echo "Running UglifyCSS"
CSSIN="/data/in/stylesheets/"
CSSOUT="/data/out/stylesheets"
cd $CSSIN
echo "Changed directory"
for f in *
do
if [ -f "$f" ]; then
uglifycss "$f" --output "$f";
fi
done
echo "Moving 'styles' to 'out'"
cp -r $CSSIN $CSSOUT
echo "Running html-minifier-terser on /folder"
HTMLIN="/data/in/"
HTMLOUT="/data/out"
html-minifier-terser --collapse-whitespace --remove-comments --file-ext html --input-dir /data/in/ --output-dir /data/out/
#echo "Moving JSON Manifest file from root to output"
#cat /data/in/manifest.json | jq -c > /data/out/manifest.json
echo "Moving other files folder from in/ to out/"
cp -r /data/in/assets /data/out/assets
cp -r /data/in/fonts /data/out/fonts
echo "Running GZIP & Brotli on all HTML, JS, CSS, JSON, SVG & TTF files"
find /data/out -type f -name \*.html -or -name \*.js -or -name \*.css -or -name \*.json -or -name \*.svg -or -name \*.ttf | while read file; do gzip -k -9 $file; brotli -k -q 11 $file; done