-
Notifications
You must be signed in to change notification settings - Fork 0
/
wit
executable file
·122 lines (113 loc) · 4.98 KB
/
wit
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
NAME=$1
if [ -d "./$NAME" ]
then
echo -e "WIT: Folder\033[1m $NAME \033[0malready exists ;("
else
if [ -n "$2" ]
then
declare -A LINKS
for arg in "$@"
do
if [ "$arg" == "--css" ]
then
LINKS["css"]=true
fi
if [ "$arg" == "--js" ]
then
LINKS[js]=true
fi
if [ "$arg" == "--bootstrap" ]
then
LINKS[bootstrap]=true
fi
if [ "$arg" == "--jquery" ]
then
LINKS[jquery]=true
fi
if [ "$arg" == "--bulma" ]
then
LINKS[bulma]=true
fi
if [ "$arg" == "--fontawesome" ]
then
LINKS[fontawesome]=true
fi
if [ "$arg" == "--aframe" ]
then
LINKS[aframe]=true
fi
done
fi
mkdir $NAME
echo "WIT: Initial folders to start a web development have been created"
echo "<!DOCTYPE html>" >> $NAME/index.html
echo "<html lang=\"en\">" >> $NAME/index.html
echo " <head>" >> $NAME/index.html
echo " <meta charset=\"UTF-8\"> " >> $NAME/index.html
echo " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" >> $NAME/index.html
echo " <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" >> $NAME/index.html
if [ -v ${LINKS} ];
then
if ! [ -v ${LINKS["aframe"]} ];
then
# echo "A-FRAME YES"
echo " <script src=\"https://aframe.io/releases/0.9.0/aframe.min.js\"></script>" >> $NAME/index.html
fi
if ! [ -v ${LINKS["css"]} ];
then
# echo "CSS YES"
echo " <link rel=\"stylesheet\" href=\"./styles/style.css\">" >> $NAME/index.html
mkdir $NAME/styles && touch $NAME/styles/style.css
fi
if ! [ -v ${LINKS["bootstrap"]} ];
then
# echo "BOOTSTRAP YES"
echo " <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\" integrity=\"sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS\" crossorigin=\"anonymous\">" >> $NAME/index.html
fi
if ! [ -v ${LINKS["bulma"]} ];
then
# echo "BULMA YES"
echo " <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css\">" >> $NAME/index.html
fi
if ! [ -v ${LINKS["fontawesome"]} ];
then
# echo "FONTAWESOME YES"
echo " <link rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.8.1/css/all.css\" integrity=\"sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf\" crossorigin=\"anonymous\">" >> $NAME/index.html
fi
fi
echo " <title>My WIT Project</title>" >> $NAME/index.html
echo " </head>" >> $NAME/index.html
echo " <body>" >> $NAME/index.html
echo " " >> $NAME/index.html
if [ -v ${LINKS} ];
then
if ! [ -v ${LINKS["bootstrap"]} ];
then
# echo "BOOTSTRAP JS YES"
echo " <script src=\"https://code.jquery.com/jquery-3.3.1.slim.min.js\" integrity=\"sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo\" crossorigin=\"anonymous\"></script>" >> $NAME/index.html
echo " <script src=\"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js\" integrity=\"sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut\" crossorigin=\"anonymous\"></script>" >> $NAME/index.html
echo " <script src=\"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js\" integrity=\"sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k\" crossorigin=\"anonymous\"></script>" >> $NAME/index.html
fi
if ! [ -v ${LINKS["jquery"]} ];
then
# echo "JQUERY JS YES"
echo " <script src=\"https://code.jquery.com/jquery-3.3.1.min.js\" integrity=\"sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=\" crossorigin=\"anonymous\"></script>" >> $NAME/index.html
fi
if ! [ -v ${LINKS["js"]} ];
then
# echo "JS YES"
echo " <script src=\"./scripts/script.js\"></script>" >> $NAME/index.html
mkdir $NAME/scripts && touch $NAME/scripts/script.js
echo "'use strict'" >> $NAME/scripts/script.js
echo "" >> $NAME/scripts/script.js
echo "const main = () => {" >> $NAME/scripts/script.js
echo " // my custom js" >> $NAME/scripts/script.js
echo "}" >> $NAME/scripts/script.js
echo "" >> $NAME/scripts/script.js
echo "window.addEventListener(\"load\", main);" >> $NAME/scripts/script.js
fi
fi
echo " </body>" >> $NAME/index.html
echo "</html>" >> $NAME/index.html
fi