-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile.py
58 lines (39 loc) · 1013 Bytes
/
makefile.py
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
import sys, os
#사용법 python makefile.py --directory-name
#print('Number of arguments: ' + str(len(sys.argv)) + ' arguments.')
#print('Argument List: ' + str(sys.argv))
filename = sys.argv[1]
print("Making HTML project folder... with name " + filename)
cwd = os.getcwd()
directory = cwd + "/" + filename
if not os.path.exists(directory):
os.makedirs(directory)
os.chdir(directory)
os.makedirs("./js")
os.makedirs("./css")
indextext = """
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="js/main.js" ></script>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
</body>
</html>
"""
jstext = """
document.addEventListener("DOMContentLoaded", function(event) {
console.log("DOM fully loaded and parsed");
});
"""
with open("index.html", "w") as f:
f.write(indextext)
os.chdir("./js")
with open("main.js", "w") as f:
f.write(jstext)
os.chdir("..")
os.chdir("./css")
with open("main.css", "w") as f:
f.write("")