-
Notifications
You must be signed in to change notification settings - Fork 107
/
build.sh
48 lines (38 loc) · 1.43 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
#!/bin/bash
mkdir compiled -p
#The compiled folder holds all the separate compiled CSS files.
subtypes=(general buttons grid headings icons forms navbar tables messages)
#You can change the subtypes used by changing this.
rm -f compiledcss.js
rm -f entireframework.min.css
#Remove the old files.
i="0"
echo "var css = {" >> compiledcss.js
#Begin making compiledcss.js
echo -n "/* Copyright 2014 Owen Versteeg; MIT licensed */" >> entireframework.min.css
#Begin making entireframework.min.css; -n is to remove the newline
#For each subtype, we compile the LESS file, minify it, and concatenate it into two files:
#entireframework.min.css and compiledcss.js
for item in ${subtypes[*]}
do
lessc "less/"$item".less" > "compiled/"$item".css"
#Compile all the LESS files.
java -jar yuicompressor-2.4.8.jar "compiled/"$item".css" -o "compiled/"$item".min.css"
#Compress all the compiled CSS files.
echo -ne " \""$item"\": \"" >> compiledcss.js
cat "compiled/"$item".min.css" >> compiledcss.js
echo -ne "\"" >> compiledcss.js
#Write lines of JSON to compiledcss.js
cat "compiled/"$item".min.css" >> entireframework.min.css
#Write the compiled and minified CSS to entireframework.min.css
if [ $((i+1)) -ne ${#subtypes[*]} ]
then
#This is a bit kludgy but whatever, bash is not my specialty.
#If this isn't the last subtype, add a comma
echo "," >> compiledcss.js
fi
i=$i+1
done
#Put an ending to compiledcss.js
echo "" >> compiledcss.js
echo "};" >> compiledcss.js