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
|
|
|
|
2023-05-24 23:20:38 +00:00
|
|
|
origin=$(pwd)
|
|
|
|
cd "dist"
|
|
|
|
|
|
|
|
echo "Cleaning dist:" *
|
|
|
|
rm -I *
|
|
|
|
|
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-14 22:51:30 +00:00
|
|
|
echo "Finding rulesets..."
|
|
|
|
rules=$(ls ../src/rulesets/*.less ../src/rulesets/**/*.less)
|
2022-10-11 09:27:55 +00:00
|
|
|
echo "Rules:"
|
|
|
|
echo "$rules"
|
2022-02-21 03:54:35 +00:00
|
|
|
echo
|
|
|
|
|
2022-10-11 09:27:55 +00:00
|
|
|
echo "Finding selectors..."
|
2022-10-14 22:51:30 +00:00
|
|
|
selectors=$(ls ../src/selectorsets/*.less ../src/selectorsets/**/*.less)
|
2022-10-11 09:27:55 +00:00
|
|
|
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"
|
2023-04-07 00:19:56 +00:00
|
|
|
echo "Compiling $base.min.css..."
|
|
|
|
lessc "$base.less" --clean-css "$base.min.css"
|
2022-02-21 03:54:35 +00:00
|
|
|
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2023-05-24 23:20:38 +00:00
|
|
|
cd "$origin"
|