ari.lt/scripts/sass.sh
Ari Archer 5c1a706d6e Add server side CSS building and preprocessing
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
2022-06-12 10:21:13 +03:00

26 lines
543 B
Bash
Executable file

#!/usr/bin/env bash
set -e
main() {
for file in $(find content/ -name '*.scss' -type f); do
bnam="${file##*/}"
out="${file%/*}/${bnam%.*}.min.css"
{
node-sass "$file" --output-style compressed >"$out"
autoprefixer-cli "$out" -o "$out.tmp"
mv "$out.tmp" "$out"
echo " >> Generated $out"
} &
done
wait
echo " >> Removing residuals"
find content/ -name '_*.min.css' -or \
-name '*.sass.css' -type f -exec rm -rfv {} \;
}
main "$@"