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
|
2020-08-08 16:16:04 +00:00
|
|
|
CSS_FILES=$TEST_DIR/css/*.css
|
2020-03-16 02:29:44 +00:00
|
|
|
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-23 14:08:44 +00:00
|
|
|
sass "$1" "${destFile}"
|
2017-09-15 18:34:10 +00:00
|
|
|
}
|
|
|
|
|
2020-08-08 16:16:04 +00:00
|
|
|
build_all_css_files()
|
2020-03-16 02:29:44 +00:00
|
|
|
{
|
|
|
|
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-08-08 16:16:04 +00:00
|
|
|
check_keywords_inclusion()
|
|
|
|
{
|
|
|
|
for f in $CSS_FILES
|
|
|
|
do
|
|
|
|
BASE=$(basename $f)
|
|
|
|
KEYWORDS_FILE=$TEST_DIR/keywords/$BASE.txt
|
|
|
|
while read p; do
|
|
|
|
if ! grep -q "$p" "$f"
|
|
|
|
then
|
|
|
|
# echo "Ok"
|
|
|
|
# else
|
|
|
|
echo "$p not found in $f"
|
|
|
|
fi
|
|
|
|
# echo "Checking for $p "
|
|
|
|
done < $KEYWORDS_FILE
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2020-03-16 02:29:44 +00:00
|
|
|
# EXECUTION
|
2017-09-15 18:34:10 +00:00
|
|
|
|
2020-08-08 16:16:04 +00:00
|
|
|
build_all_css_files $@
|
|
|
|
check_keywords_inclusion $@
|