forked from JadeVane/Allure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compressor.sh
executable file
·83 lines (67 loc) · 2.86 KB
/
compressor.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
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
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
# Select which theme to copy will be automatically transferred to the clipboard,
# Only valid in linux, and you should install xclip by hand
# Value: clear, night
clip=clear
# clip=night
# Choose whether to use the radical version by default
# Only valid in linux, and you should install xclip by hand
# Value: true, false
# radical=true
# radical=false
# ----------------------------------
# do NOT edit below
# ----------------------------------
theme=(clear night)
cd `dirname "$0"`
source_file="source-code.css"
for (( i = 0; i <= ${#theme[@]}; i++ )); do
min_file="Allure-"${theme[i]}".css"
# min_file_radical="Allure-"${theme[i]}"_radical.css"
if [[ ${theme[i]} == "clear" ]]; then
# content_raw=`sed -e '/Night mode start/,/Night mode end/d' \
# -e '/Radical version start/,/Radical version end/d' \
# ${source_file}`
# content_raw_radical=`sed -e '/Night mode start/,/Night mode end/d' \
# -e '/Stable version start/,/Stable version end/d' \
# ${source_file}`
content_raw=`sed -e '/Night mode start/,/Night mode end/d' ${source_file}`
elif [[ ${theme[i]} == "night" ]]; then
# content_raw=`sed -r -e '/Default mode start/,/Default mode end/d' \
# -e '/Radical version start/,/Radical version end/d' \
# ${source_file}`
# content_raw_radical=`sed -r -e '/Default mode start/,/Default mode end/d' \
# -e '/Stable version start/,/Stable version end/d' \
# ${source_file}`
# content_raw=`sed -r -e '/Default mode start/,/Default mode end/d' \
# -e '/Radical version start/,/Radical version end/d' \
# ${source_file}`
# content_raw_radical=`sed -r -e '/Default mode start/,/Default mode end/d' \
# -e '/Stable version start/,/Stable version end/d' \
# ${source_file}`
content_raw=`sed -r -e '/Default mode start/,/Default mode end/d' ${source_file}`
else
exit 0;
fi
echo "${content_raw}" \
| sed "s/\/\*.*\*\///g;/\/\*/,/\*\// d" \
| tr '\n' ' ' \
| tr -s ' ' ' ' \
| sed -r 's/[ ]*([:{}},;])[ ]*/\1/g'\
| sed 's/::/ ::/g' \
| sed 's/^[ ][ ]*//g' \
| sed '/^$\|^\s*$/d' > ${min_file}
# echo "${content_raw_radical}" \
# | sed "s/\/\*.*\*\///g;/\/\*/,/\*\// d" \
# | tr '\n' ' ' \
# | tr -s ' ' ' ' \
# | sed 's/^[ ][ ]*//g' \
# | sed '/^$\|^\s*$/d' > ${min_file_radical}
if [[ ${clip} == ${theme[i]} ]]; then
# if [[ ${radical} == "true" ]]; then
# xclip -sel clip ${min_file_radical}
# else
xclip -sel clip ${min_file}
# fi
fi
done