-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompress.sh
53 lines (35 loc) · 1.2 KB
/
compress.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
43
44
45
46
47
48
49
50
51
52
53
#***********************************************************
# Install YUI Compressor
#***********************************************************
sudo apt install -y yui-compressor
#***********************************************************
# Create js compression script
#***********************************************************
cat > /var/www/html/compress_js.sh <<\EOF
#!/bin/sh
for file in `find . -name "*.js"`
do
echo "Compressing $file …"
yui-compressor --type js -o $file $file
done
EOF
#***********************************************************
# Perform JS compression (Takes a VERY LONG TIME)
#***********************************************************
sh /var/www/html/compress_js.sh
#***********************************************************
# Install JPEG Optim
#***********************************************************
sudo apt -y install jpegoptim
cat > /var/www/html/compress_jpg.sh <<\EOF
#!/bin/sh
for file in `find . -name "*.jpg"`
do
echo "Compressing $file …"
jpegoptim $file
done
EOF
#***********************************************************
# Run JPEG Compression
#***********************************************************
sudo sh -c "sh /var/www/html/compress_jpg.sh"