Skip to content

Commit

Permalink
add initial compress option
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcc0nn3ll committed Jun 19, 2024
1 parent 7bcd754 commit e401c4b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions jetty-website.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,21 @@ function copy_files() {

}

function compress_files() {
local directory=$1;
echo "$FUNCNAME";

for extension in ${COMPRESS_EXTENSIONS[@]}; do
#echo "processing $extension";
find $directory -type f -name $extension -print0 | while IFS= read -r -d '' file; do
#echo "compressing $file";
if [[ ! -e $file.gz ]]; then
gzip -9 -k $file;
fi
done
done
}

function init_site() {
echo "$FUNCNAME";

Expand Down Expand Up @@ -217,18 +232,25 @@ function main() {
check_environment;
#build_ui;
build_site;
compress_files "target/site/_" #TODO choose dir better
deploy_site "$STAGE_DIR";
exit 0;
fi

if [[ $directive == "release" ]]; then
check_environment;
build_site;
compress_files "target/site/_"
deploy_site "$RELEASE_DIR";

exit 0;
fi

if [[ $directive == "compress" ]]; then
check_environment;
compress_files "target/site/_";
fi

# print usage
usage;
exit 0;
Expand All @@ -250,6 +272,7 @@ function set_global_variables() {
SUDO_USER=www-data
STAGE_DIR=$(pwd)/target/stage;
RELEASE_DIR=$(pwd)/target/release;
COMPRESS_EXTENSIONS=("*.woff" "*.woff2" "*.js" "*.css" "*.svg");

export CI=true
MIN_JAVA_VERSION=17
Expand Down

0 comments on commit e401c4b

Please sign in to comment.