deliver CSS/JS as one file

This commit is contained in:
Roland Gruber 2017-12-13 16:47:52 +01:00
parent 564fc2ed7f
commit 046a29d7d5
2 changed files with 25 additions and 25 deletions

View File

@ -26,28 +26,28 @@ fi
function minify { function minify {
local dir="$1" local dir="$1"
echo "Minify JS files in $dir" echo "Minify JS files in $dir"
local outFile=$dir/100_lam.${VERSION}.min.js
local files=`ls $dir/*.js` local files=`ls $dir/*.js`
local jsFiles=""
for file in $files; do for file in $files; do
closure-compiler --charset UTF-8 --js $file --js_output_file ${file}-MIN jsFiles="$jsFiles --js $file"
rm $file
mv ${file}-MIN $file
# add final new line to supress Debian warnings
echo "" >> $file
done done
closure-compiler --charset UTF-8 $jsFiles --js_output_file $outFile
rm $files
# add final new line to supress Debian warnings
echo "" >> $outFile
} }
# minifies the CSS files # minifies the CSS files
function minifyCSS { function minifyCSS {
local dir="$1" local dir="$1"
echo "Minify CSS files in $dir" echo "Minify CSS files in $dir"
local outFile=$dir/100_lam.${VERSION}.min.css
local files=`ls $dir/*.css` local files=`ls $dir/*.css`
for file in $files; do cat $files | cleancss -o $outFile
cleancss -o ${file}-MIN $file rm $files
rm $file
mv ${file}-MIN $file
# add final new line to supress Debian warnings # add final new line to supress Debian warnings
echo "" >> $file echo "" >> $outFile
done
} }
echo "Getting files..." echo "Getting files..."

View File

@ -1,22 +1,22 @@
#!/bin/bash #!/bin/bash
set -e set -e
env
outFile=templates/lib/100_lam.${SOURCE_DATE_EPOCH}.min.js
files=`ls templates/lib/*.js` files=`ls templates/lib/*.js`
jsFiles=""
for file in $files; do for file in $files; do
closure-compiler --charset UTF-8 --js $file --js_output_file ${file}-MIN jsFiles="$jsFiles --js $file"
rm $file
mv ${file}-MIN $file
# add final new line to supress Debian warnings
echo "" >> $file
done done
closure-compiler --charset UTF-8 $jsFiles --js_output_file $outFile
rm $files
# add final new line to supress Debian warnings
echo "" >> $outFile
files=`ls style/*.css` files=`ls style/*.css`
for file in $files; do outFile=style/100_lam.${SOURCE_DATE_EPOCH}.min.css
cleancss -o ${file}-MIN $file cat $files | cleancss -o ${outFile}
rm $file rm $files
mv ${file}-MIN $file
# add final new line to supress Debian warnings # add final new line to supress Debian warnings
echo "" >> $file echo "" >> $file
done