@@ -2,7 +2,7 @@ const fs = require("fs");
2
2
const path = require ( "path" ) ;
3
3
4
4
// 'build' 폴더를 기준으로 탐색 시작
5
- const baseDir = "./build" ;
5
+ const baseDir = ".. /build" ;
6
6
7
7
// HTML 템플릿을 시작합니다.
8
8
let htmlContent = `
@@ -12,25 +12,72 @@ let htmlContent = `
12
12
<meta charset="UTF-8">
13
13
<meta name="viewport" content="width=device-width, initial-scale=1.0">
14
14
<title>Project Index</title>
15
+ <style>
16
+ body {
17
+ font-family: Arial, sans-serif;
18
+ margin: 20px;
19
+ background-color: #f9f9f9;
20
+ color: #333;
21
+ }
22
+ h1 {
23
+ text-align: center;
24
+ color: #4CAF50;
25
+ }
26
+ ul {
27
+ list-style-type: none;
28
+ padding-left: 20px;
29
+ }
30
+ ul ul {
31
+ padding-left: 20px;
32
+ border-left: 1px solid #ccc;
33
+ }
34
+ li {
35
+ margin: 5px 0;
36
+ }
37
+ a {
38
+ text-decoration: none;
39
+ color: #4CAF50;
40
+ font-weight: bold;
41
+ }
42
+ a:hover {
43
+ color: #333;
44
+ }
45
+ .folder::before {
46
+ content: "📁 ";
47
+ font-size: 16px;
48
+ }
49
+ .file::before {
50
+ content: "📄 ";
51
+ font-size: 16px;
52
+ }
53
+ .container {
54
+ max-width: 600px;
55
+ margin: 0 auto;
56
+ background-color: #fff;
57
+ padding: 20px;
58
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
59
+ }
60
+ </style>
15
61
</head>
16
62
<body>
17
- <h1>Projects</h1>
18
- <ul>
63
+ <div class="container">
64
+ <h1>Project Index</h1>
65
+ <ul>
19
66
` ;
20
67
21
68
// 주차별로 디렉토리를 탐색
22
69
const weeks = fs . readdirSync ( baseDir ) ;
23
70
weeks . forEach ( ( week ) => {
24
71
const weekPath = path . join ( baseDir , week ) ;
25
72
if ( fs . lstatSync ( weekPath ) . isDirectory ( ) ) {
26
- htmlContent += `<li>${ week } <ul>\n` ;
73
+ htmlContent += `<li class="folder" >${ week } <ul>\n` ;
27
74
28
75
// 주차별 하위 프로젝트 탐색
29
76
const projects = fs . readdirSync ( weekPath ) ;
30
77
projects . forEach ( ( project ) => {
31
78
const projectPath = path . join ( weekPath , project ) ;
32
79
if ( fs . lstatSync ( projectPath ) . isDirectory ( ) ) {
33
- htmlContent += `<li><a href="/${ week } /${ project } ">${ project } </a></li>\n` ;
80
+ htmlContent += `<li class="file" ><a href="/${ week } /${ project } ">${ project } </a></li>\n` ;
34
81
}
35
82
} ) ;
36
83
@@ -39,9 +86,11 @@ weeks.forEach((week) => {
39
86
} ) ;
40
87
41
88
htmlContent += `
42
- </ul>
89
+ </ul>
90
+ </div>
43
91
</body>
44
92
</html>
93
+
45
94
` ;
46
95
47
96
// 생성된 HTML을 'build/index.html'에 작성
0 commit comments