-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·36 lines (30 loc) · 1.28 KB
/
build.sh
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
#!/bin/bash
# ------------------------------------------
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
# ------------------------------------------
cd ${DIR}
mkdir -p "${DIR}/dist/"
rm -rf "${DIR}/dist"/*
mkdir -p "${DIR}/dist/fonts"
mkdir -p "${DIR}/dist/css"
mkdir -p "${DIR}/dist/example"
cd "${DIR}/src/svgs"
for filename in *.svg; do
echo "Converting ${filename}..."
"${DIR}"/convert.pe "$filename" "eot" > /dev/null 2>&1
"${DIR}"/convert.pe "$filename" "ttf" > /dev/null 2>&1
"${DIR}"/convert.pe "$filename" "woff" > /dev/null 2>&1
"${DIR}"/convert.pe "$filename" "svg" > /dev/null 2>&1
name=$(echo "$filename" | cut -f 1 -d '.')
python3 "${DIR}/tocss.py" "$filename" > "${DIR}/dist/css/${name}.css"
done
python3 "${DIR}/generate_example.py" "${DIR}/src/svgs"/* > "${DIR}/dist/example/picons.html"
echo "Creating zip file for github release."
cd "${DIR}/dist"
zip -r picons.zip *