1
|
#!/bin/sh
|
2
|
|
3
|
if [ $# -ne 2 ]
|
4
|
then
|
5
|
echo 'Usage: minify-js-css.sh [setup_name] [output_folder]'
|
6
|
exit 1;
|
7
|
fi
|
8
|
|
9
|
|
10
|
echo 'preparing files...'
|
11
|
tmp_file="$(mktemp -d)"
|
12
|
#echo 'temp file is '$tmp_file
|
13
|
|
14
|
mkdir $tmp_file/$1
|
15
|
cp -rL ../setups/$1/* $tmp_file/$1
|
16
|
|
17
|
echo 'cleaning from svn metadata...'
|
18
|
find $tmp_file/$1 -iname *.svn* | xargs rm -rf
|
19
|
|
20
|
echo 'minifying css files...'
|
21
|
find $tmp_file/$1 -iname *.css | xargs java -jar yuicompressor-2.4.6.jar -o '.css$:.css'
|
22
|
|
23
|
echo 'minifying js files...'
|
24
|
find $tmp_file/$1 -iname *.js | xargs java -jar yuicompressor-2.4.6.jar -o '.js$:.js'
|
25
|
|
26
|
echo 'compressing files into '$2'/'$1'.zip'
|
27
|
zip -rq $2/$1.zip $tmp_file/$1/
|
28
|
|
29
|
rm -rf $tmp_file
|