File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,21 @@ function copy_files() {
106
106
107
107
}
108
108
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
+
109
124
function init_site() {
110
125
echo " $FUNCNAME " ;
111
126
@@ -217,18 +232,25 @@ function main() {
217
232
check_environment;
218
233
# build_ui;
219
234
build_site;
235
+ compress_files " target/site/_" # TODO choose dir better
220
236
deploy_site " $STAGE_DIR " ;
221
237
exit 0;
222
238
fi
223
239
224
240
if [[ $directive == " release" ]]; then
225
241
check_environment;
226
242
build_site;
243
+ compress_files " target/site/_"
227
244
deploy_site " $RELEASE_DIR " ;
228
245
229
246
exit 0;
230
247
fi
231
248
249
+ if [[ $directive == " compress" ]]; then
250
+ check_environment;
251
+ compress_files " target/site/_" ;
252
+ fi
253
+
232
254
# print usage
233
255
usage;
234
256
exit 0;
@@ -250,6 +272,7 @@ function set_global_variables() {
250
272
SUDO_USER=www-data
251
273
STAGE_DIR=$( pwd) /target/stage;
252
274
RELEASE_DIR=$( pwd) /target/release;
275
+ COMPRESS_EXTENSIONS=(" *.woff" " *.woff2" " *.js" " *.css" " *.svg" );
253
276
254
277
export CI=true
255
278
MIN_JAVA_VERSION=17
You can’t perform that action at this time.
0 commit comments