From 77892feeaa063e8f33c93001d930b33c3b5957b8 Mon Sep 17 00:00:00 2001 From: XPoet Date: Mon, 9 Nov 2020 10:02:41 +0800 Subject: [PATCH] perf: optimize 'side_tools' configuration item of the theme _config.yml --- layout/_partial/scripts.ejs | 13 ++++++++----- layout/page.ejs | 2 +- scripts/helpers/export-config.js | 3 ++- source/css/layout/page.styl | 2 +- source/js/dark-light-toggle.js | 3 +-- source/js/utils.js | 5 +++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/layout/_partial/scripts.ejs b/layout/_partial/scripts.ejs index 0c85c9c..0012acf 100644 --- a/layout/_partial/scripts.ejs +++ b/layout/_partial/scripts.ejs @@ -1,16 +1,19 @@ <%- js([ 'js/utils.js', 'js/header-shrink.js', - 'js/dark-light-toggle.js', 'js/main.js' ]) %> -<% if (theme.local_search.enable && config.search) { %> - <%- js('js/local-search.js') %> +<% if (theme.side_tools.enable) { %> + <%- js('js/dark-light-toggle.js') %> + + <% if (theme.back2top.enable) { %> + <%- js('js/back2top.js') %> + <% } %> <% } %> -<% if (theme.back2top.enable) { %> - <%- js('js/back2top.js') %> +<% if (theme.local_search.enable && config.search) { %> + <%- js('js/local-search.js') %> <% } %> <% if (is_post()) { %> diff --git a/layout/page.ejs b/layout/page.ejs index d8b4acc..38c2e88 100644 --- a/layout/page.ejs +++ b/layout/page.ejs @@ -56,7 +56,7 @@ <% if (theme.side_tools.enable) { %> -