bulma/test/ruby-sass.sh

66 lines
989 B
Bash
Raw 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/*
2020-11-07 17:19:18 +00:00
CSS_DIR=$TEST_DIR/build/ruby-sass
CSS_FILES=$TEST_DIR/build/ruby-sass/*.css
2020-03-16 02:29:44 +00:00
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-23 14:08:44 +00:00
sass "$1" "${destFile}"
}
2020-08-08 16:16:04 +00:00
build_all_css_files()
2020-03-16 02:29:44 +00:00
{
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-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
2020-08-08 16:16:04 +00:00
build_all_css_files $@
check_keywords_inclusion $@