12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #!/bin/bash
- # ==============================================================================
- # FUNCTIONS - START
- # ==============================================================================
- run_it()
- {
- local _name="${1-styles}"
- local _dir="${2-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
- local _target="${_dir%/*}" # deleted slash
- local _src="${_target%scripts}/src/scss/custom/${_name}.scss" # input
- local _dest="${_target%scripts}/build/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-styles}"
- local _dir="${2-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
- local _target="${_dir%/*}" # deleted slash
- local _src="${_target%scripts}/src/scss/custom/${_name}.scss" # input
- local _dest="${_target%scripts}/build/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
- }
- # ==============================================================================
- # EXECUTION - START
- # ==============================================================================
- run_it "$@" && run_compress "$@"
- # ==============================================================================
- # EXECUTION - END
- # ==============================================================================
|