mirror of
https://github.com/jgthms/bulma
synced 2026-03-21 20:54:30 -07:00
Add multiple Sass tests
This commit is contained in:
@@ -1,47 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
# CONSTANTS
|
||||
|
||||
TEST_DIR=$(dirname $BASH_SOURCE)
|
||||
FILES=$TEST_DIR/sass/*
|
||||
CSS_DIR=$TEST_DIR/css
|
||||
SASS_OPTIONS=--sourcemap=none
|
||||
|
||||
# ==============================================================================
|
||||
# FUNCTIONS - START
|
||||
# ==============================================================================
|
||||
# FUNCTIONS
|
||||
|
||||
build_sass()
|
||||
{
|
||||
echo "Processing $1 file…"
|
||||
|
||||
local fileName=$(basename -- "$1")
|
||||
local name="${fileName%.*}"
|
||||
local destFile="$CSS_DIR/$name.css"
|
||||
|
||||
sass "$1" "${destFile}" ${SASS_OPTIONS}
|
||||
}
|
||||
|
||||
run_it()
|
||||
{
|
||||
|
||||
local _src="${1-bulma.sass}"
|
||||
local _dest="${2-$(dirname "${BASH_SOURCE[0]}")/output/$(basename ${_src}).css}"
|
||||
local _options="${3---sourcemap=none}"
|
||||
rm -r $CSS_DIR
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
local _dest_dir="$(dirname "${_dest}")"
|
||||
|
||||
if [ ! -d "${_dest_dir}" ]; then
|
||||
|
||||
mkdir -p "${_dest_dir}"
|
||||
|
||||
if [ ! -d "${CSS_DIR}" ]; then
|
||||
echo "Creating $CSS_DIR directory…"
|
||||
mkdir -p "${CSS_DIR}"
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
sass "${_src}" "${_dest}" ${_options}
|
||||
|
||||
if [ $1 ]
|
||||
then
|
||||
build_sass $1
|
||||
else
|
||||
for f in $FILES
|
||||
do
|
||||
build_sass $f
|
||||
done
|
||||
fi
|
||||
}
|
||||
# run_it()
|
||||
|
||||
# ==============================================================================
|
||||
# FUNCTIONS - END
|
||||
# ==============================================================================
|
||||
|
||||
|
||||
|
||||
# ==============================================================================
|
||||
# EXECUTION - START
|
||||
# ==============================================================================
|
||||
# EXECUTION
|
||||
|
||||
run_it $@
|
||||
|
||||
# ==============================================================================
|
||||
# EXECUTION - END
|
||||
# ==============================================================================
|
||||
|
||||
Reference in New Issue
Block a user