diff options
Diffstat (limited to 'scripts/playlist.sh')
-rw-r--r-- | scripts/playlist.sh | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/scripts/playlist.sh b/scripts/playlist.sh new file mode 100644 index 0000000..5f3b98a --- /dev/null +++ b/scripts/playlist.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# ============================================================================== +# FUNCTIONS - START +# ============================================================================== + +run_it() +{ + + local _name="${1-playlist}" + local _dir="${2-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}" + local _src="${_dir%scripts}/src/scss/playlist/${_name}.scss" # input + local _dest="${_dir%scripts}/dist/css/${_name}.css" # output + local _options="${3---sourcemap=none}" + + # ---------------------------------------------------------------------------- + local _dest_dir + _dest_dir="$(dirname "${_dest}")" + + if [ ! -d "${_dest_dir}" ]; then + + mkdir -p "${_dest_dir}" + + fi + + # ---------------------------------------------------------------------------- + + sass "${_src}":"${_dest}" "${_options}" -t expanded + +} + +run_compress() +{ + + local _name="${1-playlist}" + local _dir="${2-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}" + local _src="${_dir%scripts}/src/scss/playlist/${_name}.scss" # input + local _dest="${_dir%scripts}/dist/css/${_name}.min.css" # output + local _options="${3---sourcemap=none}" + + # ---------------------------------------------------------------------------- + local _dest_dir + _dest_dir="$(dirname "${_dest}")" + + if [ ! -d "${_dest_dir}" ]; then + + mkdir -p "${_dest_dir}" + + fi + + # ---------------------------------------------------------------------------- + sass "${_src}":"${_dest}" "${_options}" -t compressed + +} + +# run_it() + +# ============================================================================== +# FUNCTIONS - END +# ============================================================================== + + + +# ============================================================================== +# EXECUTION - START +# ============================================================================== + +run_it "$@" && run_compress "$@" + +# ============================================================================== +# EXECUTION - END +# ============================================================================== |