Skip to content

Commit

Permalink
Merge pull request #375 from Stark-X/lots-of-blank-line
Browse files Browse the repository at this point in the history
- 去除生成的 html 里多余的空行
- 因 node-sass 官方废弃,根据官网指引,改用 sass
  • Loading branch information
Stark-X authored Nov 9, 2023
2 parents 8fe2bcc + 13aaef6 commit 4f7d623
Show file tree
Hide file tree
Showing 36 changed files with 352 additions and 3,172 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
autoprefixer = require('autoprefixer'),
webpack = require('webpack'),
sass = require('gulp-sass')(require('node-sass')),
sass = require('gulp-sass')(require('sass')),
browserSync = require('browser-sync').create()

/* ========== develop ========== */
Expand Down
62 changes: 31 additions & 31 deletions layout/_partial/base-background-image.ejs
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
<div class="site-intro" style="<%- partial('intro-height', {attr: 'height'}) %>">
<% var bgURL; %>
<%_ var bgURL; _%>
<!-- 主页 -->
<% if (is_home()) { %>
<% bgURL = theme.site_header_image; %>
<%_ if (is_home()) { _%>
<%_ bgURL = theme.site_header_image; _%>
<!-- 文章页 -->
<% } else if (is_post()) { %>
<% bgURL = page.header_image || theme.post_header_image || theme.site_header_image; %>
<%_ } else if (is_post()) { _%>
<%_ bgURL = page.header_image || theme.post_header_image || theme.site_header_image; _%>
<!-- 404-->
<% } else if (page.layout === "404") { %>
<% bgURL = theme._404_image || theme.site_header_image; %>
<%_ } else if (page.layout === "404") { _%>
<%_ bgURL = theme._404_image || theme.site_header_image; _%>
<!-- about页 -->
<% } else if (page.layout === "about") { %>
<% bgURL = theme.about.image || theme.site_header_image; %>
<% } %>
<%_ } else if (page.layout === "about") { _%>
<%_ bgURL = theme.about.image || theme.site_header_image; _%>
<%_ } _%>
<div class="site-intro-placeholder"></div>
<div class="site-intro-img" style="background-image: url(<%- url_for(bgURL) %>)"></div>
<div class="site-intro-meta">
<!-- 标题 -->
<h1 class="intro-title">
<!-- 主页 -->
<% if (is_home()) { %>
<%_ if (is_home()) { _%>
<%- theme.main_title || config.title %>
<!-- 文章页 -->
<% } else if(is_post()) { %>
<%_ } else if(is_post()) { _%>
<%- truncate(strip_html(page.title), {length: 80, omission: '...'}) || '[Untitled Post]' %>
<!-- 404 -->
<% } else if(page.layout === "404") { %>
<%_ } else if(page.layout === "404") { _%>
<%- page.title || '[404]'%>
<!-- about -->
<% } else if(page.layout === "about" ) { %>
<%_ } else if(page.layout === "about" ) { _%>
<%- page.title || 'About' %>
<% } %>
<%_ } _%>
</h1>
<!-- 副标题 -->
<p class="intro-subtitle">
<!-- 主页副标题 -->
<% if (is_home()) { %>
<% if(typeof theme.subtitle === 'string') { %>
<%_ if (is_home()) { _%>
<%_ if(typeof theme.subtitle === 'string') { _%>
<%- theme.subtitle %>
<% } %>
<%_ } _%>
<!-- 文章页 -->
<% } else if (is_post()) { %>
<% if(typeof page.subtitle === 'string') { %>
<%_ } else if (is_post()) { _%>
<%_ if(typeof page.subtitle === 'string') { _%>
<%- page.subtitle %>
<% } %>
<%_ } _%>
<!-- 404 -->
<% } else if (page.layout === "404") { %>
<%_ } else if (page.layout === "404") { _%>
<%- page.description %>
<% } %>
<%_ } _%>
</p>
<!-- 文章页 meta -->
<% if(is_post()) { %>
<%_ if(is_post()) { _%>
<div class="post-intros">
<!-- 文章页标签 -->
<% if(page.tags.length || page.categories) { %>
<%_ if(page.tags.length || page.categories) { _%>
<%- partial('base-title-tags', {
currPost: page,
className: 'post-intro-tags'}) %>
<% } %>
<%_ } _%>
<!-- 文章字数统计 -->
<% if(theme.reading_info) { %>
<%_ if(theme.reading_info) { _%>
<div class="post-intro-read">
<span><%- __('word_count') %>: <span class="post-count word-count"><%= wordcount(page.content) %></span><%= __('reading_time') %>: <span class="post-count reading-time"><%= min2read(page.content) %> min</span></span>
</div>
<% } %>
<%_ } _%>
<div class="post-intro-meta">
<!-- 撰写日期 -->
<span class="iconfont-archer post-intro-calander">&#xe676;</span>
<span class="post-intro-time"><%- date(page.date, "YYYY/MM/DD") %></span>
<!-- busuanzi -->
<% if (theme.busuanzi) { %>
<%_ if (theme.busuanzi) { _%>
<span id="busuanzi_container_page_pv" class="busuanzi-pv">
<span class="iconfont-archer post-intro-busuanzi">&#xe602;</span>
<span id="busuanzi_value_page_pv"></span>
</span>
<% } %>
<%_ } _%>
<!-- 文章分享 -->
<span class="share-wrapper">
<span class="iconfont-archer share-icon">&#xe71d;</span>
Expand All @@ -91,6 +91,6 @@
</span>
</div>
</div>
<% } %>
<%_ } _%>
</div>
</div>
12 changes: 6 additions & 6 deletions layout/_partial/base-footer-fixed.ejs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<footer class="footer-fixed<%- is_home() ? ' index-footer-fixed' : '' %>">
<!-- back to top button -->
<div class="footer-fixed-element">
<% if(theme.float_button_theme === 'rounded') { %>
<%_ if(theme.float_button_theme === 'rounded') { _%>
<div class="back-top back-top-hidden back-top-rounded">
<% } else { %>
<%_ } else { _%>
<div class="back-top back-top-hidden">
<% } %>
<% if(theme.float_button_theme === 'rounded') { %>
<%_ } _%>
<%_ if(theme.float_button_theme === 'rounded') { _%>
<i class="fas fa-chevron-up"></i>
<% } else { %>
<%_ } else { _%>
<div>&#xe639;</div>
<% } %>
<%_ } _%>
</div>
</div>
</footer>
30 changes: 15 additions & 15 deletions layout/_partial/base-footer.ejs
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
<footer class="footer footer-unloaded">
<!-- social -->
<% if(theme.social) { %>
<%_ if(theme.social) { _%>
<div class="social">
<%- partial('base-social') %>
</div>
<% } %>
<%_ } _%>
<!-- powered by Hexo -->
<div class="copyright">
<span id="hexo-power">Powered by <a href="https://hexo.io/" target="_blank">Hexo</a></span><span class="iconfont-archer power">&#xe635;</span><span id="theme-info">theme <a href="https://github.com/fi3ework/hexo-theme-archer" target="_blank">Archer</a></span>
</div>
<!-- website approve for Chinese user -->
<% if(theme.website_approve.enable) { %>
<%_ if(theme.website_approve.enable) { _%>
<div class="website-approve">
<% if(theme.website_approve.icp_approve) { %>
<%_ if(theme.website_approve.icp_approve) { _%>
<span id="icp-approve" class="icp-approve">
<a href="https://beian.miit.gov.cn/" target="_blank"><%- theme.website_approve.icp_approve %></a>
</span>
<% } %>
<% if(theme.website_approve.beian_approve && theme.website_approve.beian_img) { %>
<% const beianPath = theme.website_approve.beian_img %>
<%_ } _%>
<%_ if(theme.website_approve.beian_approve && theme.website_approve.beian_img) { _%>
<%_ const beianPath = theme.website_approve.beian_img _%>
<img class="beian-img" src="<%- url_for(beianPath) %>" />
<span id="beian-approve" class="beian-approve">
<a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=<%- theme.website_approve.beian_approve %>" target="_blank">京公网安备 <%- theme.website_approve.beian_approve %></a>
</span>
<% } %>
<%_ } _%>
</div>
<% } %>
<%_ } _%>
<!-- 不蒜子 -->
<% if (theme.busuanzi) { %>
<%_ if (theme.busuanzi) { _%>
<div class="busuanzi-container">
<% var sloganPieces = theme.busuanzi_slug.split('${count}') %>
<% if(theme.busuanzi_pv_or_uv === 'pv') { %>
<%_ var sloganPieces = theme.busuanzi_slug.split('${count}') _%>
<%_ if(theme.busuanzi_pv_or_uv === 'pv') { _%>
<span id="busuanzi_container_site_pv"><%- sloganPieces[0] %><span id="busuanzi_value_site_pv"></span><%- sloganPieces[1] %></span>
<% } else if (theme.busuanzi_pv_or_uv === 'uv') { %>
<%_ } else if (theme.busuanzi_pv_or_uv === 'uv') { _%>
<span id="busuanzi_container_site_uv"><%- sloganPieces[0] %><span id="busuanzi_value_site_uv"></span><%- sloganPieces[1] %></span>
<% } %>
<%_ } _%>
</div>
<% } %>
<%_ } _%>
</footer>
48 changes: 24 additions & 24 deletions layout/_partial/base-head.ejs
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<!-- title -->
<% var title = "" %>
<% if (page.title) { %>
<% title = page.title + ' · ' + theme.SEO_title || config.title %>
<% } else { %>
<% title = theme.SEO_title %>
<% } %>
<%_ var title = "" _%>
<%_ if (page.title) { _%>
<%_ title = page.title + ' · ' + theme.SEO_title || config.title _%>
<%_ } else { _%>
<%_ title = theme.SEO_title _%>
<%_ } _%>
<!-- keywords -->
<% var keywords = "" %>
<% var keywordsArr = [page.keywords, theme.SEO_keywords] %>
<% var keywords = keywordsArr.filter(function(item){ return item }).join(',') %>
<%_ var keywords = "" _%>
<%_ var keywordsArr = [page.keywords, theme.SEO_keywords] _%>
<%_ var keywords = keywordsArr.filter(function(item){ return item }).join(',') _%>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="author" content="<%- config.author %>">
<meta name="renderer" content="webkit">
<meta name="copyright" content="<%- config.author %>">
<% if (keywords) { %>
<%_ if (keywords) { _%>
<meta name="keywords" content="<%- keywords %>">
<% } else { %>
<%_ } else { _%>
<meta name="keywords" content="<%- config.title %>,<%- config.author %>">
<% } %>
<%_ } _%>
<meta name="description" content="<%- config.description %>">
<%- open_graph({twitter_id: theme.twitter, google_plus: theme.google_plus, fb_admins: theme.fb_admins, fb_app_id: theme.fb_app_id}) %>
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="icon" href="<%- url_for(theme.favicon) %>">
<% if (theme.feed != undefined) { %>
<%_ if (theme.feed != undefined) { _%>
<link rel="alternate" href="<%= url_for(theme.feed.path) %>" title="<%= theme.main_title %>" type="application/atom+xml">
<% } %>
<%_ } _%>
<title><%= title %></title>
<%- partial('base-preload-polyfill') %>
<%- partial('critical-css/critical-style') %>
Expand All @@ -40,7 +40,7 @@
<link rel="preload" href="<%- url_for('font/Oswald-Regular.ttf') %>" as="font" crossorigin>
<link rel="preload" href="https://at.alicdn.com/t/font_327081_1dta1rlogw17zaor.woff" as="font" crossorigin>
<!-- algolia -->
<% if (theme.algolia_search != undefined && theme.algolia_search.enable) { %>
<%_ if (theme.algolia_search != undefined && theme.algolia_search.enable) { _%>
<script>
var hits = JSON.parse('<%- JSON.stringify(theme.algolia_search.hits) %>')
var labels = JSON.parse('<%- JSON.stringify(theme.algolia_search.labels) %>')
Expand All @@ -53,9 +53,9 @@
labels: labels
}
</script>
<% } %>
<!-- 百度统计 -->
<% if(theme.baidu_analytics) { %>
<%_ } _%>
<!-- 百度统计 -->
<%_ if(theme.baidu_analytics) { _%>
<script>
var _hmt = _hmt || [];
(function () {
Expand All @@ -65,9 +65,9 @@
s.parentNode.insertBefore(hm, s);
})();
</script>
<% } %>
<!-- CNZZ 统计 -->
<% if (theme.CNZZ_analytics) { %>
<%_ } _%>
<!-- 谷歌统计 -->
<%_ if (theme.google_analytics) { _%>
<script>
var cnzz_s_tag = document.createElement('script');
cnzz_s_tag.type = 'text/javascript';
Expand All @@ -77,9 +77,9 @@
var root_s = document.getElementsByTagName('script')[0];
root_s.parentNode.insertBefore(cnzz_s_tag, root_s);
</script>
<% } %>
<%_ } _%>
<!-- Google tag (gtag.js) -->
<% if (theme.google_analytics) { %>
<%_ if (theme.google_analytics) { _%>
<script async src="https://www.googletagmanager.com/gtag/js?id=<%- theme.google_analytics %>"></script>
<script>
window.dataLayer = window.dataLayer || [];
Expand All @@ -88,5 +88,5 @@
gtag('config', '<%- theme.google_analytics %>');
</script>
<% } %>
<%_ } _%>
</head>
22 changes: 11 additions & 11 deletions layout/_partial/base-header.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
</div>
<!-- sidebar menu button -->
<div class="header-element">
<% if(theme.float_button_theme === 'rounded') { %>
<%_ if(theme.float_button_theme === 'rounded') { _%>
<div class="header-sidebar-menu header-sidebar-menu-rounded">
<% } else { %>
<%_ } else { _%>
<div class="header-sidebar-menu">
<% } %>
<% if(theme.float_button_theme === 'rounded') { %>
<%_ } _%>
<%_ if(theme.float_button_theme === 'rounded') { _%>
<i class="fas fa-bars"></i>
<% } else { %>
<%_ } else { _%>
<div style="padding-left: 1px;">&#xe775;</div>
<% } %>
<%_ } _%>
</div>
</div>
<!-- header actions -->
Expand All @@ -29,18 +29,18 @@
</span>
</div>
<!-- toggle banner for post layout -->
<% if (is_post()) { %>
<% if(theme.post_banner_theme === 'clean') { %>
<%_ if (is_post()) { _%>
<%_ if(theme.post_banner_theme === 'clean') { _%>
<div class="banner banner-clean">
<% } else { %>
<%_ } else { _%>
<div class="banner">
<% } %>
<%_ } _%>
<div class="blog-title header-element">
<a href="<%- url_for() %>"><%= theme.main_title || config.title%></a>
</div>
<div class="post-title header-element">
<a href="#" class="post-name"><%- page.title %></a>
</div>
</div>
<% } %>
<%_ } _%>
</header>
Loading

0 comments on commit 4f7d623

Please sign in to comment.