bulma/test/sass-compile-tester.sh

46 lines
595 B
Bash
Raw Permalink Normal View History

#!/bin/bash
2020-03-16 02:29:44 +00:00
# CONSTANTS
2020-03-16 02:29:44 +00:00
TEST_DIR=$(dirname $BASH_SOURCE)
FILES=$TEST_DIR/sass/*
CSS_DIR=$TEST_DIR/css
SASS_OPTIONS=--sourcemap=none
2020-03-16 02:29:44 +00:00
# FUNCTIONS
2020-03-16 02:29:44 +00:00
build_sass()
{
2020-03-16 02:29:44 +00:00
echo "Processing $1 file…"
local fileName=$(basename -- "$1")
local name="${fileName%.*}"
local destFile="$CSS_DIR/$name.css"
2020-03-16 02:29:44 +00:00
sass "$1" "${destFile}" ${SASS_OPTIONS}
}
2020-03-16 02:29:44 +00:00
run_it()
{
rm -r $CSS_DIR
2020-03-16 02:29:44 +00:00
if [ ! -d "${CSS_DIR}" ]; then
echo "Creating $CSS_DIR directory…"
mkdir -p "${CSS_DIR}"
fi
2020-03-16 02:29:44 +00:00
if [ $1 ]
then
build_sass $1
else
for f in $FILES
do
build_sass $f
done
fi
}
2020-03-16 02:29:44 +00:00
# EXECUTION
run_it $@