Skip to content

Commit a6640cc

Browse files
committed
Merge branch 'main' of github.com:jetty/jetty.website
2 parents 012b394 + e401c4b commit a6640cc

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

jetty-website.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,21 @@ function copy_files() {
106106

107107
}
108108

109+
function compress_files() {
110+
local directory=$1;
111+
echo "$FUNCNAME";
112+
113+
for extension in ${COMPRESS_EXTENSIONS[@]}; do
114+
#echo "processing $extension";
115+
find $directory -type f -name $extension -print0 | while IFS= read -r -d '' file; do
116+
#echo "compressing $file";
117+
if [[ ! -e $file.gz ]]; then
118+
gzip -9 -k $file;
119+
fi
120+
done
121+
done
122+
}
123+
109124
function init_site() {
110125
echo "$FUNCNAME";
111126

@@ -217,18 +232,25 @@ function main() {
217232
check_environment;
218233
#build_ui;
219234
build_site;
235+
compress_files "target/site/_" #TODO choose dir better
220236
deploy_site "$STAGE_DIR";
221237
exit 0;
222238
fi
223239

224240
if [[ $directive == "release" ]]; then
225241
check_environment;
226242
build_site;
243+
compress_files "target/site/_"
227244
deploy_site "$RELEASE_DIR";
228245

229246
exit 0;
230247
fi
231248

249+
if [[ $directive == "compress" ]]; then
250+
check_environment;
251+
compress_files "target/site/_";
252+
fi
253+
232254
# print usage
233255
usage;
234256
exit 0;
@@ -250,6 +272,7 @@ function set_global_variables() {
250272
SUDO_USER=www-data
251273
STAGE_DIR=$(pwd)/target/stage;
252274
RELEASE_DIR=$(pwd)/target/release;
275+
COMPRESS_EXTENSIONS=("*.woff" "*.woff2" "*.js" "*.css" "*.svg");
253276

254277
export CI=true
255278
MIN_JAVA_VERSION=17

0 commit comments

Comments
 (0)