-
Notifications
You must be signed in to change notification settings - Fork 1
/
_build.sh
executable file
·63 lines (49 loc) · 1.2 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Maybe a Makefile would be better...
origin=$(pwd)
cd "dist"
echo "Cleaning dist:" *
rm -I *
echo "Finding mixins..."
mixins=$(ls ../src/mixins/**.less)
echo "Mixins:"
echo "$mixins"
echo
echo "Finding rulesets..."
rules=$(ls ../src/rulesets/*.less ../src/rulesets/**/*.less)
echo "Rules:"
echo "$rules"
echo
echo "Finding selectors..."
selectors=$(ls ../src/selectorsets/*.less ../src/selectorsets/**/*.less)
echo "Selectors:"
echo "$selectors"
echo
for selector in $selectors
do
for rule in $rules
do
bselector=$(basename "$selector" ".less")
brule=$(basename "$rule" ".less")
# Dot notation is used so .module.css files can be generated
base="$brule.$bselector"
echo "Creating $base.less..."
echo "// Mixins" > "$base.less"
for mixin in $mixins
do
echo "@import (less) \"$mixin\";" >> "$base.less"
done
echo >> "$base.less"
echo "// Selector" >> "$base.less"
echo "@import (less) \"$selector\";" >> "$base.less"
echo >> "$base.less"
echo "// Rule" >> "$base.less"
echo "@import (less) \"$rule\";" >> "$base.less"
echo >> "$base.less"
echo "Compiling $base.css..."
lessc "$base.less" "$base.css"
echo "Compiling $base.min.css..."
lessc "$base.less" --clean-css "$base.min.css"
done
done
cd "$origin"