aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/aplaylist.sh
blob: faae8e07193eb1ee25d0527002c221c084c56bd9 (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-aplaylist}"
    local _dir="${2-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
    local _target="${_dir%/*}" # deleted slash
    local _src="${_target%scripts}/src/scss/aplaylist/${_name}.scss" # input
    local _dest="${_target%scripts}/dist/css/${_name}.css" # output

    # ----------------------------------------------------------------------------
    local _dest_dir
    _dest_dir="$(dirname "${_dest}")"

    if [ ! -d "${_dest_dir}" ]; then

        mkdir -p "${_dest_dir}"

    fi

    # ----------------------------------------------------------------------------

    sassc -t expanded "${_src}" "${_dest}"

}

run_compress()
{

    local _name="${1-aplaylist}"
    local _dir="${2-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
    local _target="${_dir%/*}" # deleted slash
    local _src="${_target%scripts}/src/scss/aplaylist/${_name}.scss" # input
    local _dest="${_target%scripts}/dist/css/${_name}.min.css" # output

    # ----------------------------------------------------------------------------
    local _dest_dir
    _dest_dir="$(dirname "${_dest}")"

    if [ ! -d "${_dest_dir}" ]; then

        mkdir -p "${_dest_dir}"

    fi

    # ----------------------------------------------------------------------------
    sassc -t compressed "${_src}" "${_dest}"

}

# run_it()

# ==============================================================================
# FUNCTIONS - END
# ==============================================================================



# ==============================================================================
# EXECUTION - START
# ==============================================================================

run_it "$@"  && run_compress "$@"

# ==============================================================================
# EXECUTION - END
# ==============================================================================