Skip to content

Commit 02f80f4

Browse files
author
전진호
committed
fix: make index page prettier
1 parent 65e4350 commit 02f80f4

File tree

1 file changed

+55
-6
lines changed

1 file changed

+55
-6
lines changed

.scripts/index-page-builder.js

+55-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const fs = require("fs");
22
const path = require("path");
33

44
// 'build' 폴더를 기준으로 탐색 시작
5-
const baseDir = "./build";
5+
const baseDir = "../build";
66

77
// HTML 템플릿을 시작합니다.
88
let htmlContent = `
@@ -12,25 +12,72 @@ let htmlContent = `
1212
<meta charset="UTF-8">
1313
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1414
<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>
1561
</head>
1662
<body>
17-
<h1>Projects</h1>
18-
<ul>
63+
<div class="container">
64+
<h1>Project Index</h1>
65+
<ul>
1966
`;
2067

2168
// 주차별로 디렉토리를 탐색
2269
const weeks = fs.readdirSync(baseDir);
2370
weeks.forEach((week) => {
2471
const weekPath = path.join(baseDir, week);
2572
if (fs.lstatSync(weekPath).isDirectory()) {
26-
htmlContent += `<li>${week}<ul>\n`;
73+
htmlContent += `<li class="folder">${week}<ul>\n`;
2774

2875
// 주차별 하위 프로젝트 탐색
2976
const projects = fs.readdirSync(weekPath);
3077
projects.forEach((project) => {
3178
const projectPath = path.join(weekPath, project);
3279
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`;
3481
}
3582
});
3683

@@ -39,9 +86,11 @@ weeks.forEach((week) => {
3986
});
4087

4188
htmlContent += `
42-
</ul>
89+
</ul>
90+
</div>
4391
</body>
4492
</html>
93+
4594
`;
4695

4796
// 생성된 HTML을 'build/index.html'에 작성

0 commit comments

Comments
 (0)