2017-09-15 18:34:10 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-03-16 02:29:44 +00:00
|
|
|
# CONSTANTS
|
2017-09-15 18:34:10 +00:00
|
|
|
|
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
|
2017-09-15 18:34:10 +00:00
|
|
|
|
2020-03-16 02:29:44 +00:00
|
|
|
# FUNCTIONS
|
2017-09-15 18:34:10 +00:00
|
|
|
|
2020-03-16 02:29:44 +00:00
|
|
|
build_sass()
|
2017-09-15 18:34:10 +00:00
|
|
|
{
|
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"
|
2017-09-15 18:34:10 +00:00
|
|
|
|
2020-03-16 02:29:44 +00:00
|
|
|
sass "$1" "${destFile}" ${SASS_OPTIONS}
|
2017-09-15 18:34:10 +00:00
|
|
|
}
|
|
|
|
|
2020-03-16 02:29:44 +00:00
|
|
|
run_it()
|
|
|
|
{
|
|
|
|
rm -r $CSS_DIR
|
2017-09-15 18:34:10 +00:00
|
|
|
|
2020-03-16 02:29:44 +00:00
|
|
|
if [ ! -d "${CSS_DIR}" ]; then
|
|
|
|
echo "Creating $CSS_DIR directory…"
|
|
|
|
mkdir -p "${CSS_DIR}"
|
|
|
|
fi
|
2017-09-15 18:34:10 +00:00
|
|
|
|
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
|
|
|
|
}
|
2017-09-15 18:34:10 +00:00
|
|
|
|
2020-03-16 02:29:44 +00:00
|
|
|
# EXECUTION
|
2017-09-15 18:34:10 +00:00
|
|
|
|
|
|
|
run_it $@
|