-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminifierobfusc.sh
executable file
·42 lines (36 loc) · 1.01 KB
/
minifierobfusc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
#Author: Bulot Geoffrey
#Release: 2016-12-07
echo "******************************";
echo "* *";
echo "* Compressing CSS/JS Files *";
echo "* *";
echo "******************************";
type=$1;
path=$2;
if [ $# -lt 2 ]; then
echo "\n\t Usage: <type> <path>";
else
echo "\nWork in progress...Please be patient for a while\n";
fi
saved=0
for f in `find -name "*.css" -not -name "*.min.css"`;
do
target=${f%.*}.min.css
echo "\t- "$f to $target
FILESIZE=$(stat -c%s "$f")
yui-compressor --type css --nomunge -o $target $f
FILESIZEC=$(stat -c%s "$target")
diff=$(($FILESIZE - $FILESIZEC))
saved=$(($saved + $diff))
echo "\t $diff bytes saved"
done
echo "\n";
echo "*******************************";
echo "* Total saved: $saved bytes *";
echo "*******************************";
echo "* *";
echo "* Bye Bye dude!! *";
echo "*******************************";
# params ?
chown www-data.www-data $path/*.min.css