Skip to content

Commit 541f64d

Browse files
committed
fixed typos and enhanced script leafo#199
1 parent cbfd682 commit 541f64d

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

tests/bootstrap.sh

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,45 @@
11
echo "This script clones twitter bootsrap, compiles it with lessc and lessphp,"
22
echo "cleans up results with csstidy, and outputs diff. To run it, you need to"
33
echo "have git, csstidy and lessc installed."
4+
echo ""
45

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"
612

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=$@
1217
fi
1318

14-
if [ ! -d 'bootsrap/' ]
15-
then
19+
mkdir -p tmp
20+
21+
if [ ! -d 'bootstrap/' ]; then
1622
echo ">> Cloning bootstrap to bootstrap/"
1723
git clone https://github.com/twitter/bootstrap
1824
fi
1925

2026
echo ">> Lessc compilation"
2127
lessc bootstrap/less/bootstrap.less tmp/bootstrap.lessc.css
28+
2229
echo ">> Lessphp compilation"
23-
../plessc bootstrap/less/bootstrap.less tmp/bootstrap.lessphp.csstidy
30+
../plessc bootstrap/less/bootstrap.less tmp/bootstrap.lessphp.css
2431
echo ">> Cleanup and convert"
2532
csstidy tmp/bootstrap.lessc.css $csstidy_params tmp/bootstrap.lessc.clean.css
2633
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+
2744
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

Comments
 (0)