-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild
executable file
·51 lines (43 loc) · 1.45 KB
/
build
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
#!/bin/sh
echo Creating output directory
rm -r output
mkdir output
echo Compiling main HTML file
node -e "$(cat <<END_NODE
file = require('fs').readFileSync('client/index.html.ejs', 'utf8');
index = require('ejs').render(file, { environment: 'build' })
.replace(/<script[^>]+>/, '<script src="scripts/main.js">')
.replace('stylesheets/main', 'stylesheets/main.css')
console.log(index);
END_NODE
)" > output/index_full.html
if which html5small > /dev/null 2>&1; then
echo Compressing main HTML file
html5small output/index_full.html > output/index.html
rm output/index_full.html
else
mv output/index_full.html output/index.html
fi
echo Compiling stylesheet
mkdir output/stylesheets
node_modules/less/bin/lessc --compress client/stylesheets/main.less > output/stylesheets/main_full.css
if which csspress > /dev/null 2>&1; then
echo Compressing stylesheet
csspress output/stylesheets/main_full.css > output/stylesheets/main.css
rm output/stylesheets/main_full.css
else
mv output/stylesheets/main_full.css output/stylesheets/main.css
fi
echo Copying fonts
cp client/stylesheets/*.otf client/stylesheets/*.ttf output/stylesheets
echo Copying image files
cp -r client/images output
echo Compiling JavaScript files
cd client/scripts
../../node_modules/requirejs/bin/r.js -o app.build.js
cd ../..
mkdir output/scripts
mv client/scripts/main-built.js output/scripts/main.js
echo Copying swf files
cp -r client/scripts/swf output/scripts
echo Done