Skip to content

Commit bc49f6f

Browse files
committed
feat: Add contributors pages.
1 parent c3a24f2 commit bc49f6f

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

build/build.mjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const rootIndexJSPath = path.resolve(process.cwd(), 'template', 'js', 'index.js'
1212
const dataJsonPath = path.resolve(process.cwd(), 'dist', 'data.json');
1313
const dataJsonMinPath = path.resolve(process.cwd(), 'dist', 'data.min.json');
1414
const cssPath = path.resolve(deployDir, 'css', 'index.css');
15+
const contributorsPath = path.resolve(deployDir, 'CONTRIBUTORS.svg');
1516

1617
;(async () => {
1718
try {
@@ -71,6 +72,24 @@ const cssPath = path.resolve(deployDir, 'css', 'index.css');
7172
command_length: jsonData.data.length
7273
}
7374
);
75+
76+
let svgStr = '';
77+
if (FS.existsSync(contributorsPath)) {
78+
svgStr = (await FS.readFile(contributorsPath)).toString();
79+
}
80+
81+
await createTmpToHTML(
82+
path.resolve(process.cwd(), 'template', 'contributors.ejs'),
83+
path.resolve(deployDir, 'contributors.html'),
84+
{
85+
p: '/contributors.html',
86+
n: '搜索',
87+
d: '最专业的Linux命令大全,命令搜索引擎,内容包含Linux命令手册、详解、学习,值得收藏的Linux命令速查手册。',
88+
arr: jsonData.data,
89+
command_length: jsonData.data.length,
90+
contributors: svgStr,
91+
}
92+
);
7493

7594
await Promise.all(jsonData.data.map(async (item, idx) => {
7695
item.command_length = jsonData.data.length;

template/contributors.ejs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<%- include('partial/header'); %>
2+
<%- include('widget/search',{type: "list"}); %>
3+
<div class="contributors">
4+
<h1>Contributors</h1>
5+
<div><%=describe.contributors ? describe.contributors : '' %></div>
6+
</div>
7+
<%- include('widget/footer',{type: "list"}); %>
8+
<%- include('partial/footer'); %>

template/styl/index.styl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,18 @@ a {
295295
}
296296
}
297297

298-
.header_inner, .hotlist, .search_list {
298+
.header_inner, .hotlist, .search_list, .contributors {
299299
max-width 920px
300300
margin 0 auto
301301
}
302302

303+
.contributors {
304+
padding 79px 27px
305+
a {
306+
font-weight: bold;
307+
}
308+
}
309+
303310
@media mq-mobile {
304311
.header{
305312
width inherit

template/widget/footer.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
<br /> 共搜集到
1616
<span id="commands_info">
1717
<%=describe.command_length?describe.command_length:''%>
18-
</span> 个Linux命令
18+
</span> 个Linux命令,超过 <a href="<%=relative_path%>contributors.html">50+</a> 的贡献者
1919
</div>

0 commit comments

Comments
 (0)