aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/playlist.sh
blob: 5f3b98a506a1699027ca1f450503bd7c1948557e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
# ==============================================================================