hexo-theme-yet-the-books-optimize 1.0.4 → 2.0.20260103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/.github/workflows/main.yml +19 -0
  2. package/LICENSE +21 -21
  3. package/index.js +2 -2
  4. package/languages/default.yml +4 -4
  5. package/languages/en.yml +4 -4
  6. package/languages/zh-CN.yml +4 -4
  7. package/layout/_partial/_analytics/baidu.ejs +8 -8
  8. package/layout/_partial/_analytics/cnzz.ejs +3 -3
  9. package/layout/_partial/_analytics/google.ejs +6 -6
  10. package/layout/_partial/_analytics/gtags.ejs +7 -7
  11. package/layout/_partial/_analytics/gtm-body.ejs +5 -5
  12. package/layout/_partial/_analytics/gtm-head.ejs +8 -8
  13. package/layout/_partial/_analytics/la.ejs +3 -3
  14. package/layout/_partial/_analytics/tencent.ejs +8 -8
  15. package/layout/_partial/_comment/DiscussBot.ejs +16 -16
  16. package/layout/_partial/_comment/changyan.ejs +13 -13
  17. package/layout/_partial/_comment/disqus.ejs +17 -17
  18. package/layout/_partial/_comment/disqusjs.ejs +16 -16
  19. package/layout/_partial/_comment/giscus.ejs +12 -12
  20. package/layout/_partial/_comment/gitalk.ejs +13 -13
  21. package/layout/_partial/_comment/gitment.ejs +13 -13
  22. package/layout/_partial/_comment/livere.ejs +11 -11
  23. package/layout/_partial/_comment/utteranc.ejs +9 -9
  24. package/layout/_partial/_comment/valine.ejs +9 -9
  25. package/layout/_partial/analytics.ejs +17 -17
  26. package/layout/_partial/head.ejs +28 -28
  27. package/layout/_partial/header.ejs +9 -9
  28. package/layout/_partial/post-nav.ejs +32 -32
  29. package/layout/archive.ejs +79 -79
  30. package/layout/category.ejs +24 -24
  31. package/layout/index.ejs +62 -62
  32. package/layout/layout.ejs +12 -12
  33. package/layout/post.ejs +39 -39
  34. package/move_config.js +17 -17
  35. package/package.json +17 -17
  36. package/scripts/helper/css_auto_version.js +17 -17
  37. package/scripts/helper/js_auto_version.js +17 -17
  38. package/source/css/style.css +663 -622
  39. package/source/js/core.js +24 -24
@@ -1,33 +1,33 @@
1
- <nav class="post-nav">
2
- <% site.categories.map(function(category){ %>
3
- <% page.categories.map(function(page_category){ %>
4
- <% if(page_category.name == category.name){ %> <!-- 先找到与当前文字相同的目录 -->
5
- <% let i = 0;%>
6
- <% category.posts.sort('-date').map(function(post){ %>
7
- <% i++; %>
8
- <% if(post.title == page.title){ %> <!-- 在找到当前文章所在的 index -->
9
- <% let ix = 0;%>
10
- <% category.posts.sort('-date').map(function(post){ %>
11
- <% ix++; %>
12
-
13
- <% if(ix == i + 1 && post.title){ %> <!-- 上一篇文章 -->
14
- <div class="old">
15
- <span>上一章</span>
16
- <a href="<%- url_for(post.path) %>"> <%= post.title %></a>
17
- </div>
18
- <% } %>
19
-
20
- <% if(ix == i - 1 && post.title){ %> <!-- 下一篇文章 -->
21
- <div class="new">
22
- <span>下一章</span>
23
- <a href="<%- url_for(post.path) %>"> <%= post.title %></a>
24
- </div>
25
- <% } %>
26
-
27
- <% }) %>
28
- <% } %>
29
- <% }) %>
30
- <% } %>
31
- <% })%>
32
- <% }) %>
1
+ <nav class="post-nav">
2
+ <% site.categories.map(function(category){ %>
3
+ <% page.categories.map(function(page_category){ %>
4
+ <% if(page_category.name == category.name){ %> <!-- 先找到与当前文字相同的目录 -->
5
+ <% let i = 0;%>
6
+ <% category.posts.sort('-date').map(function(post){ %>
7
+ <% i++; %>
8
+ <% if(post.title == page.title){ %> <!-- 在找到当前文章所在的 index -->
9
+ <% let ix = 0;%>
10
+ <% category.posts.sort('-date').map(function(post){ %>
11
+ <% ix++; %>
12
+
13
+ <% if(ix == i + 1 && post.title){ %> <!-- 上一篇文章 -->
14
+ <div class="old">
15
+ <span>上一章</span>
16
+ <a href="<%- url_for(post.path) %>"> <%= post.title %></a>
17
+ </div>
18
+ <% } %>
19
+
20
+ <% if(ix == i - 1 && post.title){ %> <!-- 下一篇文章 -->
21
+ <div class="new">
22
+ <span>下一章</span>
23
+ <a href="<%- url_for(post.path) %>"> <%= post.title %></a>
24
+ </div>
25
+ <% } %>
26
+
27
+ <% }) %>
28
+ <% } %>
29
+ <% }) %>
30
+ <% } %>
31
+ <% })%>
32
+ <% }) %>
33
33
  </nav>
@@ -1,80 +1,80 @@
1
- <div class="content">
2
- <div class="banner">
3
- <div class="container">
4
- <h1>归档</h1>
5
- </div>
6
- </div>
7
- <div class="container">
8
- <article class="post archive">
9
- <%- list_tags({
10
- show_count: true,
11
- style: "unordered list",
12
- separator: ", "
13
- }) %>
14
-
15
- <% if(theme.archives.switch) { %>
16
- <p>当前默认显示的分类为:
17
- <% for (index in theme.archives.categories) { %>
18
- <%- theme.archives.categories[index] %>
19
- <% } %>
20
- (<a class="display-btn" onclick="displayAll()">显示所有</a>)
21
- </p>
22
- <% } %>
23
-
24
- <% // 参考:https://github.com/SukkaW/hexo-theme-suka/blob/master/layout/_pages/archive.ejs %>
25
- <% function buildArchive(posts, year) { %>
26
- <h2><%= year %></h2>
27
- <ul class="catalogue">
28
- <% posts.sort('date',-1).each(post => { %>
29
- <% post.categories.map(function(category){ %>
30
- <%
31
- // 判断是否为已设置需要显示的分类
32
- let displayTF = false;
33
- if(theme.archives.switch) {
34
- for (index in theme.archives.categories) {
35
- if(category.name == theme.archives.categories[index]){
36
- displayTF = true;
37
- }
38
- }
39
- } else {
40
- displayTF = true;
41
- }
42
- %>
43
- <% if(displayTF){ %>
44
- <li class="display"><a href="<%- url_for(post.path) %>" >
45
- <span class="title"><%- category.name %>:<%- post.title %></span>
46
- <span class="date"><span><%= date(post.date, 'MM-DD') %></span></span>
47
- </a></li>
48
- <% } else { %>
49
- <li class="hidden"><a href="<%- url_for(post.path) %>" >
50
- <span class="title"><%- category.name %>:<%- post.title %></span>
51
- <span class="date"><span><%= date(post.date, 'MM-DD') %></span></span>
52
- </a></li>
53
- <% } %>
54
- <% }) %>
55
- <% }) %>
56
- </ul>
57
- <% } %>
58
-
59
- <%
60
- if (!page.year) {
61
- let years = {};
62
- let allpost = page.tag ? site.tags.findOne({name: page.tag}).posts : site.posts;
63
- allpost.each(post => years[post.date.year()] = null);
64
- for (let year of Object.keys(years).sort((a, b) => b - a)) {
65
- let posts = allpost.filter(p => p.date.year() == year);
66
- buildArchive(posts, year)
67
- }
68
- } else {
69
- let year = page.year;
70
- let posts = site.posts.filter(p => p.date.year() == year);
71
- buildArchive(posts, year)
72
- }
73
- %>
74
- </article>
75
- </div>
76
- </div>
77
-
78
- <script>
79
-
1
+ <div class="content">
2
+ <div class="banner">
3
+ <div class="container">
4
+ <h1>归档</h1>
5
+ </div>
6
+ </div>
7
+ <div class="container">
8
+ <article class="post archive">
9
+ <%- list_tags({
10
+ show_count: true,
11
+ style: "unordered list",
12
+ separator: ", "
13
+ }) %>
14
+
15
+ <% if(theme.archives.switch) { %>
16
+ <p>当前默认显示的分类为:
17
+ <% for (index in theme.archives.categories) { %>
18
+ <%- theme.archives.categories[index] %>
19
+ <% } %>
20
+ (<a class="display-btn" onclick="displayAll()">显示所有</a>)
21
+ </p>
22
+ <% } %>
23
+
24
+ <% // 参考:https://github.com/SukkaW/hexo-theme-suka/blob/master/layout/_pages/archive.ejs %>
25
+ <% function buildArchive(posts, year) { %>
26
+ <h2><%= year %></h2>
27
+ <ul class="catalogue">
28
+ <% posts.sort('date',-1).each(post => { %>
29
+ <% post.categories.map(function(category){ %>
30
+ <%
31
+ // 判断是否为已设置需要显示的分类
32
+ let displayTF = false;
33
+ if(theme.archives.switch) {
34
+ for (index in theme.archives.categories) {
35
+ if(category.name == theme.archives.categories[index]){
36
+ displayTF = true;
37
+ }
38
+ }
39
+ } else {
40
+ displayTF = true;
41
+ }
42
+ %>
43
+ <% if(displayTF){ %>
44
+ <li class="display"><a href="<%- url_for(post.path) %>" >
45
+ <span class="title"><%- category.name %>:<%- post.title %></span>
46
+ <span class="date"><span><%= date(post.date, 'MM-DD') %></span></span>
47
+ </a></li>
48
+ <% } else { %>
49
+ <li class="hidden"><a href="<%- url_for(post.path) %>" >
50
+ <span class="title"><%- category.name %>:<%- post.title %></span>
51
+ <span class="date"><span><%= date(post.date, 'MM-DD') %></span></span>
52
+ </a></li>
53
+ <% } %>
54
+ <% }) %>
55
+ <% }) %>
56
+ </ul>
57
+ <% } %>
58
+
59
+ <%
60
+ if (!page.year) {
61
+ let years = {};
62
+ let allpost = page.tag ? site.tags.findOne({name: page.tag}).posts : site.posts;
63
+ allpost.each(post => years[post.date.year()] = null);
64
+ for (let year of Object.keys(years).sort((a, b) => b - a)) {
65
+ let posts = allpost.filter(p => p.date.year() == year);
66
+ buildArchive(posts, year)
67
+ }
68
+ } else {
69
+ let year = page.year;
70
+ let posts = site.posts.filter(p => p.date.year() == year);
71
+ buildArchive(posts, year)
72
+ }
73
+ %>
74
+ </article>
75
+ </div>
76
+ </div>
77
+
78
+ <script>
79
+
80
80
  </script>
@@ -1,25 +1,25 @@
1
- <div class="content">
2
- <div class="banner">
3
- <div class="container">
4
- <h1>《<%- page.category %>》的目录</h1>
5
- </div>
6
- </div>
7
- <div class="container">
8
- <ul class="catalogue">
9
- <%
10
- let order = theme.order_by
11
- page.posts.each(function (post) {
12
- if(post.order_by !== null && post.order_by !== undefined){ order = post.order_by }
13
- })
14
- %>
15
- <% page.posts.sort(order).each(function (post) { %>
16
- <li>
17
- <a href="<%- url_for(post.path) %>">
18
- <span class="title"><%= post.title %></span>
19
- <span class="date"><span><%- date(post.date, "YYYY-MM-DD") %></span></span>
20
- </a>
21
- </li>
22
- <% }) %>
23
- </ul>
24
- </div>
1
+ <div class="content">
2
+ <div class="banner">
3
+ <div class="container">
4
+ <h1>《<%- page.category %>》的目录</h1>
5
+ </div>
6
+ </div>
7
+ <div class="container">
8
+ <ul class="catalogue">
9
+ <%
10
+ let order = theme.order_by
11
+ page.posts.each(function (post) {
12
+ if(post.order_by !== null && post.order_by !== undefined){ order = post.order_by }
13
+ })
14
+ %>
15
+ <% page.posts.sort(order).each(function (post) { %>
16
+ <li>
17
+ <a href="<%- url_for(post.path) %>">
18
+ <span class="title"><%= post.title %></span>
19
+ <span class="date"><span><%- date(post.date, "YYYY-MM-DD") %></span></span>
20
+ </a>
21
+ </li>
22
+ <% }) %>
23
+ </ul>
24
+ </div>
25
25
  </div>
package/layout/index.ejs CHANGED
@@ -1,75 +1,75 @@
1
- <div class="content home">
2
- <div class="banner">
3
- <div class="container">
4
- <h1><%= config.subtitle %></h1>
5
- <div class="search">
6
- <!-- <form id="search_form" action_e="<%= theme.search + "site:" +config.url %>" onsubmit="return search();">
7
- <input autocomplete='off' id="search_value" name="q" type="search" placeholder="<%= __('placeholder') %>">
8
- <input class="submit" type="submit" value="<%= __('search') %>">
9
- </form> -->
10
- </div>
11
- </div>
12
- </div>
13
- <div class="container">
14
- <div class="category">
15
- <% site.categories.sort('length').map(function(category){ %>
16
- <% let cover = ""
17
- let color = "docs";
18
- let icon = "";
19
- let desc = "-";
20
- category.posts.sort('-date').map(function(post){
21
- if(post.cover!==undefined && cover==""){
22
- cover = post.cover
23
- }
24
- if(post.color!==undefined && color=="red"){
25
- color = post.color
26
- };
27
- if(post.icon!==undefined){
28
- icon = post.icon;
1
+ <div class="content home">
2
+ <div class="banner">
3
+ <div class="container">
4
+ <h1><%= config.subtitle %></h1>
5
+ <div class="search">
6
+ <!-- <form id="search_form" action_e="<%= theme.search + "site:" +config.url %>" onsubmit="return search();">
7
+ <input autocomplete='off' id="search_value" name="q" type="search" placeholder="<%= __('placeholder') %>">
8
+ <input class="submit" type="submit" value="<%= __('search') %>">
9
+ </form> -->
10
+ </div>
11
+ </div>
12
+ </div>
13
+ <div class="container">
14
+ <div class="category">
15
+ <% site.categories.sort('length').map(function(category){ %>
16
+ <% let cover = ""
17
+ let color = "docs";
18
+ let icon = "";
19
+ let desc = "-";
20
+ category.posts.sort('-date').map(function(post){
21
+ if(post.cover!==undefined && cover==""){
22
+ cover = post.cover
23
+ }
24
+ if(post.color!==undefined && color=="red"){
25
+ color = post.color
26
+ };
27
+ if(post.icon!==undefined){
28
+ icon = post.icon;
29
29
  };
30
30
  if(post.desc!==undefined){
31
31
  desc = post.desc;
32
- };
33
- });
34
-
35
- %>
36
-
37
- <% if(cover == "" && icon == ''){ %>
38
- <a class="category-item" href="<%- url_for(category.path) %>">
39
- <div class="cover cover_docs">
32
+ };
33
+ });
34
+
35
+ %>
36
+
37
+ <% if(cover == "" && icon == ''){ %>
38
+ <a class="category-item" href="<%- url_for(category.path) %>">
39
+ <div class="cover cover_docs">
40
40
  <div class="custom-show">
41
41
  <h1 class="custom-h1"><%= category.name %></h1>
42
42
  <div class="custom-desc"><%= desc %></div>
43
43
  <div class="custom-count"><%= category.length %>篇</div>
44
- </div>
45
- </div>
46
- </a>
47
- <% }%>
48
-
49
- <% if ( icon != '' ) { %>
50
- <a class="category-item" href="<%- url_for(category.path) %>">
51
- <div class="cover <%= icon %>">
44
+ </div>
45
+ </div>
46
+ </a>
47
+ <% }%>
48
+
49
+ <% if ( icon != '' ) { %>
50
+ <a class="category-item" href="<%- url_for(category.path) %>">
51
+ <div class="cover <%= icon %>">
52
52
  <img data-sizes="auto" style="height: 60px; width: 60px;margin-top: 60px;" src="/images/cover/<%= icon %>.png" class="lazyload">
53
53
  <div class="custom-show">
54
54
  <h1 class="custom-h1"><%= category.name %></h1>
55
55
  <div class="custom-desc"><%= desc %></div>
56
56
  <div class="custom-count"><%= category.length %>篇</div>
57
- </div>
58
- </div>
59
- </a>
60
- <% } %>
61
-
62
- <% if ( cover != '' ) { %>
63
- <a class="category-item" href="<%- url_for(category.path) %>">
64
- <div class="cover">
65
- <img data-sizes="auto" src="<%= cover %>" class="lazyload" alt="<%= category.name %>">
66
- <h1><%= category.name %></h1>
67
- <div class="custom-coun"><%= category.length %>篇</div>
68
- </div>
69
- </a>
70
- <% } %>
71
-
72
- <% }) %>
73
- </div>
74
- </div>
57
+ </div>
58
+ </div>
59
+ </a>
60
+ <% } %>
61
+
62
+ <% if ( cover != '' ) { %>
63
+ <a class="category-item" href="<%- url_for(category.path) %>">
64
+ <div class="cover">
65
+ <img data-sizes="auto" src="<%= cover %>" class="lazyload" alt="<%= category.name %>">
66
+ <h1><%= category.name %></h1>
67
+ <div class="custom-coun"><%= category.length %>篇</div>
68
+ </div>
69
+ </a>
70
+ <% } %>
71
+
72
+ <% }) %>
73
+ </div>
74
+ </div>
75
75
  </div>
package/layout/layout.ejs CHANGED
@@ -1,12 +1,12 @@
1
- <!DOCTYPE html>
2
- <html lang="<%= config.language %>">
3
- <head>
4
- <%- partial('_partial/head') %>
5
- </head>
6
-
7
- <body>
8
- <%- partial('_partial/header') %>
9
- <%- body %>
10
- <%- partial('_partial/footer') %>
11
- </body>
12
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="<%= config.language %>">
3
+ <head>
4
+ <%- partial('_partial/head') %>
5
+ </head>
6
+
7
+ <body>
8
+ <%- partial('_partial/header') %>
9
+ <%- body %>
10
+ <%- partial('_partial/footer') %>
11
+ </body>
12
+ </html>
package/layout/post.ejs CHANGED
@@ -1,40 +1,40 @@
1
- <div class="content">
2
- <div class="banner">
3
- <div class="container">
4
- <h1><%= page.title %></h1>
5
- <div class="info"><span class="date"><%- date(page.date, "YYYY年M月D日") %></span>•<%= config.author %>
6
- <% if (page.categories && page.categories.length){ %>
7
- 《<%- list_categories(page.categories, {
8
- show_count: false,
9
- class: 'nexmoefont icon-appstore-fill ',
10
- style: 'none',
11
- separator: ''
12
- }) %>》
13
- <% } %>
14
- <% if (theme.github.repo && theme.github.edit) { %>
15
- <a href="<%= 'https://github.com/' + theme.github.repo + '/tree/master/source/' + page.source %>" target="_blank" rel="external nofollow noreferrer noopener">编辑</a>
16
- <% } %>
17
- </div>
18
-
19
- </div>
20
- </div>
21
- <div class="container">
22
- <article class="post">
23
- <%- page.content %>
24
- <br>
25
- <%- list_tags(page.tags, {
26
- show_count: true,
27
- style: "unordered list",
28
- separator: ", "
29
- }) %>
30
- </article>
31
- </div>
32
- <div class="other">
33
- <div class="container">
34
- <%- is_post() ? partial('_partial/post-nav') : '' %>
35
- </div>
36
- </div>
37
- <div class="container comment">
38
- <%- theme.comment ? partial('_partial/_comment/' + theme.comment) : '' %>
39
- </div>
1
+ <div class="content">
2
+ <div class="banner">
3
+ <div class="container">
4
+ <h1><%= page.title %></h1>
5
+ <div class="info"><span class="date"><%- date(page.date, "YYYY年M月D日") %></span>•<%= config.author %>
6
+ <% if (page.categories && page.categories.length){ %>
7
+ 《<%- list_categories(page.categories, {
8
+ show_count: false,
9
+ class: 'nexmoefont icon-appstore-fill ',
10
+ style: 'none',
11
+ separator: ''
12
+ }) %>》
13
+ <% } %>
14
+ <% if (theme.github.repo && theme.github.edit) { %>
15
+ <a href="<%= 'https://github.com/' + theme.github.repo + '/tree/master/source/' + page.source %>" target="_blank" rel="external nofollow noreferrer noopener">编辑</a>
16
+ <% } %>
17
+ </div>
18
+
19
+ </div>
20
+ </div>
21
+ <div class="container">
22
+ <article class="post">
23
+ <%- page.content %>
24
+ <br>
25
+ <%- list_tags(page.tags, {
26
+ show_count: true,
27
+ style: "unordered list",
28
+ separator: ", "
29
+ }) %>
30
+ </article>
31
+ </div>
32
+ <div class="other">
33
+ <div class="container">
34
+ <%- is_post() ? partial('_partial/post-nav') : '' %>
35
+ </div>
36
+ </div>
37
+ <div class="container comment">
38
+ <%- theme.comment ? partial('_partial/_comment/' + theme.comment) : '' %>
39
+ </div>
40
40
  </div>
package/move_config.js CHANGED
@@ -1,18 +1,18 @@
1
- const fs = require('fs')
2
-
3
- if (fs.existsSync('../hexo/package.json')){
4
- const version = JSON.parse(fs.readFileSync('../hexo/package.json')).version
5
- if (version.split('.')[0] === '5') {
6
- const oldConfigPath = '../../_config.old.yml'
7
- const configPath = '../../_config.yet-the-books.yml'
8
- if (!fs.existsSync(configPath) && !fs.existsSync(oldConfigPath)) {
9
- fs.writeFileSync(configPath, fs.readFileSync('./_config.yml'))
10
- }
11
- if (fs.existsSync(configPath)){
12
- fs.writeFileSync( '../../_config.new.yml', fs.readFileSync('./_config.yml'))
13
- }
14
- fs.unlinkSync('./_config.yml')
15
- }
16
- }
17
-
1
+ const fs = require('fs')
2
+
3
+ if (fs.existsSync('../hexo/package.json')){
4
+ const version = JSON.parse(fs.readFileSync('../hexo/package.json')).version
5
+ if (version.split('.')[0] === '5') {
6
+ const oldConfigPath = '../../_config.old.yml'
7
+ const configPath = '../../_config.yet-the-books.yml'
8
+ if (!fs.existsSync(configPath) && !fs.existsSync(oldConfigPath)) {
9
+ fs.writeFileSync(configPath, fs.readFileSync('./_config.yml'))
10
+ }
11
+ if (fs.existsSync(configPath)){
12
+ fs.writeFileSync( '../../_config.new.yml', fs.readFileSync('./_config.yml'))
13
+ }
14
+ fs.unlinkSync('./_config.yml')
15
+ }
16
+ }
17
+
18
18
  // 借鉴自 https://github.com/HCLonely/hexo-theme-webstack/blob/master/move_config.js
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
- {
2
- "name": "hexo-theme-yet-the-books-optimize",
3
- "version": "1.0.4",
4
- "description": "🌙 It starts with the appearance and stays true to the words. A blog theme dedicated to those who love to think.",
5
- "git": "https://github.com/wan-lights/hexo-theme-yet-the-books-optimize.git",
6
- "keywords": [
7
- "hexo",
8
- "theme",
9
- "yet-the-books-custom"
10
- ],
11
- "author": "custom",
12
- "license": "MIT",
13
- "main": "index.js",
14
- "scripts": {
15
- "postinstall": "node ./move_config.js"
16
- }
17
- }
1
+ {
2
+ "name": "hexo-theme-yet-the-books-optimize",
3
+ "version": "2.0.20260103",
4
+ "description": "🌙 It starts with the appearance and stays true to the words. A blog theme dedicated to those who love to think.",
5
+ "git": "https://github.com/wan-lights/hexo-theme-yet-the-books-optimize.git",
6
+ "keywords": [
7
+ "hexo",
8
+ "theme",
9
+ "yet-the-books-custom"
10
+ ],
11
+ "author": "custom",
12
+ "license": "MIT",
13
+ "main": "index.js",
14
+ "scripts": {
15
+ "postinstall": "node ./move_config.js"
16
+ }
17
+ }
@@ -1,17 +1,17 @@
1
- 'use strict';
2
-
3
- function cssAutoVersionHelper(...args) {
4
- return args.reduce((result, path, i) => {
5
- if (i) result += '\n';
6
-
7
- if (Array.isArray(path)) {
8
- return result + Reflect.apply(cssAutoVersionHelper, this, path);
9
- }
10
- if (!path.includes('?') && !path.endsWith('.css')) path += '.css';
11
- let url_suffix = "?v=" + new Date().getTime();
12
- let url = this.url_for(path) + url_suffix;
13
- return `${result}<link rel="stylesheet" href="${url}">`;
14
- }, '');
15
- }
16
-
17
- hexo.extend.helper.register('css_auto_version', cssAutoVersionHelper);
1
+ 'use strict';
2
+
3
+ function cssAutoVersionHelper(...args) {
4
+ return args.reduce((result, path, i) => {
5
+ if (i) result += '\n';
6
+
7
+ if (Array.isArray(path)) {
8
+ return result + Reflect.apply(cssAutoVersionHelper, this, path);
9
+ }
10
+ if (!path.includes('?') && !path.endsWith('.css')) path += '.css';
11
+ let url_suffix = "?v=" + new Date().getTime();
12
+ let url = this.url_for(path) + url_suffix;
13
+ return `${result}<link rel="stylesheet" href="${url}">`;
14
+ }, '');
15
+ }
16
+
17
+ hexo.extend.helper.register('css_auto_version', cssAutoVersionHelper);