2022-02-21 03:54:35 +00:00
|
|
|
#!/bin/bash
|
2022-02-21 04:37:33 +00:00
|
|
|
# Maybe a Makefile would be better...
|
2022-02-21 03:54:35 +00:00
|
|
|
|
2022-10-11 09:27:55 +00:00
|
|
|
echo "Finding mixins..."
|
|
|
|
mixins=$(ls ../src/mixins/**.less)
|
|
|
|
echo "Mixins:"
|
|
|
|
echo "$mixins"
|
2022-02-21 03:54:35 +00:00
|
|
|
echo
|
|
|
|
|
2022-10-11 09:27:55 +00:00
|
|
|
echo "Finding rules..."
|
|
|
|
rules=$(ls ../src/rules/*.less ../src/rules/**/*.less)
|
|
|
|
echo "Rules:"
|
|
|
|
echo "$rules"
|
2022-02-21 03:54:35 +00:00
|
|
|
echo
|
|
|
|
|
2022-10-11 09:27:55 +00:00
|
|
|
echo "Finding selectors..."
|
|
|
|
selectors=$(ls ../src/selectors/*.less ../src/selectors/**/*.less)
|
|
|
|
echo "Selectors:"
|
|
|
|
echo "$selectors"
|
|
|
|
echo
|
|
|
|
|
|
|
|
for selector in $selectors
|
2022-02-21 03:54:35 +00:00
|
|
|
do
|
2022-10-11 09:27:55 +00:00
|
|
|
for rule in $rules
|
2022-02-21 03:54:35 +00:00
|
|
|
do
|
|
|
|
|
2022-10-11 09:27:55 +00:00
|
|
|
bselector=$(basename "$selector" ".less")
|
|
|
|
brule=$(basename "$rule" ".less")
|
2022-02-21 03:54:35 +00:00
|
|
|
# Dot notation is used so .module.css files can be generated
|
2022-10-11 09:27:55 +00:00
|
|
|
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"
|
2022-02-21 03:54:35 +00:00
|
|
|
|
2022-10-11 09:27:55 +00:00
|
|
|
echo "// Selector" >> "$base.less"
|
|
|
|
echo "@import (less) \"$selector\";" >> "$base.less"
|
|
|
|
echo >> "$base.less"
|
2022-02-21 03:54:35 +00:00
|
|
|
|
2022-10-11 09:27:55 +00:00
|
|
|
echo "// Rule" >> "$base.less"
|
|
|
|
echo "@import (less) \"$rule\";" >> "$base.less"
|
|
|
|
echo >> "$base.less"
|
2022-02-21 03:54:35 +00:00
|
|
|
|
2022-10-11 09:27:55 +00:00
|
|
|
echo "Compiling $base.css..."
|
2022-04-29 23:18:15 +00:00
|
|
|
lessc "$base.less" "$base.css"
|
2022-02-21 03:54:35 +00:00
|
|
|
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|