1
1
echo " This script clones twitter bootsrap, compiles it with lessc and lessphp,"
2
2
echo " cleans up results with csstidy, and outputs diff. To run it, you need to"
3
3
echo " have git, csstidy and lessc installed."
4
+ echo " "
4
5
5
- csstidy_params=" --allow_html_in_templates=false --compress_colors=false --compress_font-weight=false --discard_invalid_properties=false --lowercase_s=false --preserve_css=true --remove_bslash=false --remove_last\;=false --sort-properties=true --sort-selectors=true --timestamp=false --silent=true --merge_selectors=0 --case-properties=0 --optimize-shorthands=0 --template=high"
6
+ csstidy_params=" --allow_html_in_templates=false --compress_colors=false
7
+ --compress_font-weight=false --discard_invalid_properties=false
8
+ --lowercase_s=false --preserve_css=true --remove_bslash=false
9
+ --remove_last_;=false --sort-properties=true --sort-selectors=true
10
+ --timestamp=false --silent=true --merge_selectors=0 --case-properties=0
11
+ --optimize-shorthands=0 --template=high"
6
12
7
- diff_params=" -b -u -t -B"
8
-
9
- if [ ! -d ' tmp/' ]
10
- then
11
- mkdir tmp/
13
+ if [ -z " $@ " ]; then
14
+ diff_tool=" diff -b -u -t -B"
15
+ else
16
+ diff_tool=$@
12
17
fi
13
18
14
- if [ ! -d ' bootsrap/' ]
15
- then
19
+ mkdir -p tmp
20
+
21
+ if [ ! -d ' bootstrap/' ]; then
16
22
echo " >> Cloning bootstrap to bootstrap/"
17
23
git clone https://github.com/twitter/bootstrap
18
24
fi
19
25
20
26
echo " >> Lessc compilation"
21
27
lessc bootstrap/less/bootstrap.less tmp/bootstrap.lessc.css
28
+
22
29
echo " >> Lessphp compilation"
23
- ../plessc bootstrap/less/bootstrap.less tmp/bootstrap.lessphp.csstidy
30
+ ../plessc bootstrap/less/bootstrap.less tmp/bootstrap.lessphp.css
24
31
echo " >> Cleanup and convert"
25
32
csstidy tmp/bootstrap.lessc.css $csstidy_params tmp/bootstrap.lessc.clean.css
26
33
csstidy tmp/bootstrap.lessphp.css $csstidy_params tmp/bootstrap.lessphp.clean.css
34
+
35
+ # put a newline after { and :
36
+ function split() {
37
+ sed ' s/\(;\|{\)/\1\n/g'
38
+ }
39
+
40
+ # csstidy is messed up and wont output to stdout when there are a bunch of options
41
+ cat tmp/bootstrap.lessc.clean.css | split | tee tmp/bootstrap.lessc.clean.css
42
+ cat tmp/bootstrap.lessphp.clean.css | split | tee tmp/bootstrap.lessphp.clean.css
43
+
27
44
echo " >> Doing diff"
28
- diff $diff_params tmp/bootstrap.lessc.clean.css tmp/bootstrap.lessphp.clean.css > tmp/diff
29
- cat tmp/diff
45
+ $diff_tool tmp/bootstrap.lessc.clean.css tmp/bootstrap.lessphp.clean.css
0 commit comments