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

View File

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