-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.sh
executable file
·41 lines (34 loc) · 1.04 KB
/
publish.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
#!/bin/sh
die () {
echo "$1" >/dev/stderr
exit 1
}
mkdir site
mkdir site/s
cp -R web/i site
mkdir site/j
cp web/j/jquery-1.7.1.min.js site/j/jquery.min.js
cp web/j/prettify.js site/j/prettify.min.js
# takes <output-dir> as parameter, relying on the existence of <output-dir>/j
python2.7 pages.py site
# combine JavaScript
for f in site/j/*.js; do
mv "$f" site/j/tmp.js
cat site/j/tmp.js web/j/pe.js > "$f"
rm site/j/tmp.js
done
# TODO minimize JavaScript solutions
#java -jar util/compiler.jar -js web/j/prettify.js > site/j/prettify.min.js || die "Failed to minimize JS"
# minimize CSS
java -jar util/yuicompressor-2.4.2.jar web/s/pe.css > site/s/pe.min.css && \
java -jar util/yuicompressor-2.4.2.jar web/s/desert.css > site/s/desert.min.css || \
die "Failed to minimize CSS"
# use git to commit site to gh-pages root branch
git checkout gh-pages || die "Failed to switch to gh-pages branch"
cp -R site/* .
rm -rf site
git add .
git commit -m "Publish site."
#git push origin gh-pages
# go back to the main branch
git checkout master