From 9c3d3fdeed2090b4debea6f566d234cce02f479d Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 4 May 2020 03:52:23 +0800 Subject: [PATCH] Improved loading performance by merging CSS files. --- _includes/head.html | 82 +++++++++++++---------------- assets/css/{ => _addon}/main.scss | 6 +-- assets/css/{ => _addon}/syntax.scss | 2 - assets/css/_addon/variables.scss | 3 ++ assets/css/archives.scss | 15 +++--- assets/css/categories.scss | 15 +++--- assets/css/category-tag.scss | 16 +++--- assets/css/home.scss | 13 +++-- assets/css/page.scss | 10 ++++ assets/css/post.scss | 18 +++---- assets/css/tags.scss | 14 ++--- 11 files changed, 98 insertions(+), 96 deletions(-) rename assets/css/{ => _addon}/main.scss (99%) rename assets/css/{ => _addon}/syntax.scss (99%) create mode 100644 assets/css/page.scss diff --git a/_includes/head.html b/_includes/head.html index f27941a..aff9e1f 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -53,8 +53,6 @@ integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ=" crossorigin="anonymous"> - - @@ -64,37 +62,45 @@ integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ=" crossorigin="anonymous"> - - {% if page.layout == 'home' %} + + {% elsif page.layout == 'page' %} + + {% if page.title == 'Categories' %} + + + + {% elsif page.title == 'Tags' %} + + + + {% elsif page.title == 'Archives' %} + + + + {% else %} + + + + {% endif %} + + {% elsif page.layout == 'category' or page.layout == 'tag' %} + + + + {% elsif page.layout == 'post' %} + + + + {% if site.toc and page.toc %} + + + {% endif %} + {% endif %} - {% if page.title == 'Categories' and page.layout == 'page' %} - - - {% endif %} - - {% if page.title == 'Tags' and page.layout == 'page' %} - - - {% endif %} - - {% if page.layout == 'category' or page.layout == 'tag' %} - - - {% endif %} - - {% if page.title == 'Archives' and page.layout == 'page' %} - - - {% endif %} - - {% if page.title == 'About' and page.layout == 'page' %} - - - {% endif %} - - - - - - {% if site.toc and page.toc %} - - - - - - - {% endif %} - + {% if site.toc and page.toc and page.layout == 'post' %} + + + {% endif %} diff --git a/assets/css/main.scss b/assets/css/_addon/main.scss similarity index 99% rename from assets/css/main.scss rename to assets/css/_addon/main.scss index 83ef96e..5fd1481 100644 --- a/assets/css/main.scss +++ b/assets/css/_addon/main.scss @@ -1,6 +1,4 @@ ---- ---- -/*! +/* * The main styles. * v2.0 * https://github.com/cotes2020/jekyll-theme-chirpy @@ -66,8 +64,6 @@ body { /*--- sidebar layout ---*/ -$tab-height: 3.3rem; -$tab-cursor-height: 1.6rem; $tab-count: {{ site.data.tabs | size }}; $sidebar-display: "sidebar-display"; diff --git a/assets/css/syntax.scss b/assets/css/_addon/syntax.scss similarity index 99% rename from assets/css/syntax.scss rename to assets/css/_addon/syntax.scss index 830e04e..e14e793 100644 --- a/assets/css/syntax.scss +++ b/assets/css/_addon/syntax.scss @@ -1,5 +1,3 @@ ---- ---- /* * The syntax highlight. * v2.0 diff --git a/assets/css/_addon/variables.scss b/assets/css/_addon/variables.scss index e95e0fd..b591354 100644 --- a/assets/css/_addon/variables.scss +++ b/assets/css/_addon/variables.scss @@ -9,6 +9,9 @@ /*--- ↓ width and height ----*/ +$tab-height: 3.3rem; +$tab-cursor-height: 1.6rem; + $sidebar-width-small: 210px; $sidebar-width-medium: 260px; $sidebar-width-large: 350px; diff --git a/assets/css/archives.scss b/assets/css/archives.scss index 7496b3a..b13a854 100644 --- a/assets/css/archives.scss +++ b/assets/css/archives.scss @@ -1,12 +1,13 @@ --- +# Style for Archives +# v2.0 +# https://github.com/cotes2020/jekyll-theme-chirpy +# © 2019 Cotes Chung +# MIT License --- -/*! - Style for Archives - v2.0 - https://github.com/cotes2020/jekyll-theme-chirpy - © 2019 Cotes Chung - MIT License -*/ + + +{% include_relative _addon/main.scss %} %date-timeline { content: ""; diff --git a/assets/css/categories.scss b/assets/css/categories.scss index 8098f1e..c7b7a54 100644 --- a/assets/css/categories.scss +++ b/assets/css/categories.scss @@ -1,12 +1,13 @@ --- +# Style for Tab Categories +# v2.0 +# https://github.com/cotes2020/jekyll-theme-chirpy +# © 2019 Cotes Chung +# MIT License --- -/*! - Style for Tab Categories - v2.0 - https://github.com/cotes2020/jekyll-theme-chirpy - © 2019 Cotes Chung - MIT License -*/ + + +{% include_relative _addon/main.scss %} %category-icon-color { color: gray; diff --git a/assets/css/category-tag.scss b/assets/css/category-tag.scss index 7532cc5..274e58e 100644 --- a/assets/css/category-tag.scss +++ b/assets/css/category-tag.scss @@ -1,13 +1,13 @@ --- +# Style for page Category and Tag +# v2.0 +# https://github.com/cotes2020/jekyll-theme-chirpy +# © 2019 Cotes Chung +# MIT License --- -/*! - Style for page Category and Tag - v2.0 - https://github.com/cotes2020/jekyll-theme-chirpy - © 2019 Cotes Chung - MIT License -*/ -@import "_addon/module"; + + +{% include_relative _addon/main.scss %} #page-category, #page-tag { ul>li { diff --git a/assets/css/home.scss b/assets/css/home.scss index c3bd701..ae77b38 100644 --- a/assets/css/home.scss +++ b/assets/css/home.scss @@ -1,13 +1,12 @@ --- +# Style for Homepage +# v2.0 +# https://github.com/cotes2020/jekyll-theme-chirpy +# © 2019 Cotes Chung +# MIT License --- -/*! - Style for Homepage - v2.0 - https://github.com/cotes2020/jekyll-theme-chirpy - © 2019 Cotes Chung - MIT License -*/ +{% include_relative _addon/main.scss %} #post-list { margin-top: 1rem; diff --git a/assets/css/page.scss b/assets/css/page.scss new file mode 100644 index 0000000..10ef9fa --- /dev/null +++ b/assets/css/page.scss @@ -0,0 +1,10 @@ +--- +# The default style for layout Page +# v2.2 +# https://github.com/cotes2020/jekyll-theme-chirpy +# © 2020 Cotes Chung +# MIT License +--- + +{% include_relative _addon/main.scss %} +{% include_relative _addon/syntax.scss %} diff --git a/assets/css/post.scss b/assets/css/post.scss index 447fdc5..7bbfc67 100644 --- a/assets/css/post.scss +++ b/assets/css/post.scss @@ -1,14 +1,14 @@ --- +# Post-specific style +# v2.0 +# https://github.com/cotes2020/jekyll-theme-chirpy +# © 2019 Cotes Chung +# MIT License --- -/*! - Post-specific style - v2.0 - https://github.com/cotes2020/jekyll-theme-chirpy - © 2019 Cotes Chung - MIT License -*/ -@import "_addon/variables"; -@import "_addon/module"; + + +{% include_relative _addon/main.scss %} +{% include_relative _addon/syntax.scss %} $prompt-older: "{{ site.data.label.post.button.previous }}"; $prompt-newer: "{{ site.data.label.post.button.next }}"; diff --git a/assets/css/tags.scss b/assets/css/tags.scss index cad54f3..0b708fb 100644 --- a/assets/css/tags.scss +++ b/assets/css/tags.scss @@ -1,13 +1,13 @@ --- +# Styles for Tab Tags +# v2.0 +# https://github.com/cotes2020/jekyll-theme-chirpy +# © 2019 Cotes Chung +# MIT License --- -/*! -* Styles for Tab Tags -* v2.0 -* https://github.com/cotes2020/jekyll-theme-chirpy -* © 2019 Cotes Chung -* MIT License -*/ + +{% include_relative _addon/main.scss %} .tag { border-radius: 0.7em;