forked from zluca/Sidebar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·63 lines (52 loc) · 1.08 KB
/
build.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
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
# This script requares:
# uglifyjs
# https://www.npmjs.com/package/uglify-js
# minify
# https://github.com/tdewolff/minify
# svgo
# https://www.npmjs.com/package/svgo
# web-ext
# https://www.npmjs.com/package/web-ext
rm -rf ./temp
mkdir ./temp
mkdir ./temp/icons
mkdir ./builds
cp -r ./_locales ./temp/
cp *.html ./temp/
cp *.json ./temp/
cp ./icons/*.gif ./temp/icons/
cp ./icons/*.png ./temp/icons/
cp LICENSE ./temp/
jsFiles=$(ls *.js)
i=$(ls *.js | wc -l)
while [ "$i" -gt 0 ]
do
jsFile=$(echo "$jsFiles" | sed -n ${i}p)
echo $jsFile
uglifyjs --ecma 6 -cm -o ./temp/$jsFile $jsFile
let 'i -= 1'
done
cssFiles=$(ls *.css)
i=$(ls *.css | wc -l)
while [ "$i" -gt 0 ]
do
cssFile=$(echo "$cssFiles" | sed -n ${i}p)
echo $cssFile
minify --mime text/css -o ./temp/$cssFile $cssFile
let 'i -= 1'
done
cd ./icons
svgFiles=$(ls *.svg)
i=$(ls *.svg | wc -l)
while [ "$i" -gt 0 ]
do
svgFile=$(echo "$svgFiles" | sed -n ${i}p)
echo $svgFile
svgo -p 0 -i $svgFile -o ../temp/icons/$svgFile
let 'i -= 1'
done
cd ../temp
web-ext build
cp ./web-ext-artifacts/*.zip ../builds
rm -rf ../temp