Project

General

Profile

1
if [ "$1" != "" ]; then
2

    
3
	echo "Find html files in $1";
4
	find $1 -name "*.html" -type f
5
	echo " ";
6
	echo " ";
7
	echo " ";
8
	files=( $(find $1 -name "*.html" -type f) )
9

    
10
	echo " Minifying...";
11
	echo " ";
12
	total = 0;
13
	for entry in $(find $1 -name "*.html" -type f)
14
	do
15
	echo
16
		s=$(stat -c%s "$entry");
17
		echo "Size of $entry = $s  bytes.";
18
		cat $entry  | sed -e :a -re 's/<!--.*?-->//g;/<!--/N;//ba'| awk '{printf "%s",$0} END {print ""}' | tr -s " "> $entry".mini";
19
		n=$entry".mini";
20
		ns=$(stat -c%s "$n");
21
		dif=$((s-ns));
22
		total=$((total+dif));	
23
		echo Size of $n = $ns  bytes.
24

    
25
	done
26
	for entry in $(find $1 -name "*.html" -type f)
27
	do
28
	echo
29
	        cat $entry".mini"  > $entry;
30
		rm $entry".mini";
31

    
32
	done
33
	echo Total size $total
34
else
35
	echo "Give a path";
36
fi
(6-6/14)