Improved loading performance by merging CSS files.

This commit is contained in:
Cotes Chung 2020-05-04 03:52:23 +08:00
parent 8c4b186c52
commit 9c3d3fdeed
11 changed files with 98 additions and 96 deletions

View File

@ -53,8 +53,6 @@
integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ=" integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ="
crossorigin="anonymous"> crossorigin="anonymous">
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/css/main.css">
<link rel="stylesheet" <link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin="anonymous"> integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin="anonymous">
@ -64,37 +62,45 @@
integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ=" integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ="
crossorigin="anonymous"> crossorigin="anonymous">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/main.css">
{% if page.layout == 'home' %} {% if page.layout == 'home' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/home.css" as="style"> <link rel="preload" href="{{ site.baseurl }}/assets/css/home.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/home.css"> <link rel="stylesheet" href="{{ site.baseurl }}/assets/css/home.css">
{% elsif page.layout == 'page' %}
{% if page.title == 'Categories' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/categories.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/categories.css">
{% elsif page.title == 'Tags' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/tags.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/tags.css">
{% elsif page.title == 'Archives' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/archives.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/archives.css">
{% else %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/page.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/page.css">
{% endif %}
{% elsif page.layout == 'category' or page.layout == 'tag' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/category-tag.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/category-tag.css">
{% elsif page.layout == 'post' %}
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/css/post.css">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/post.css">
{% if site.toc and page.toc %}
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css" />
{% endif %}
{% endif %} {% endif %}
{% if page.title == 'Categories' and page.layout == 'page' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/categories.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/categories.css">
{% endif %}
{% if page.title == 'Tags' and page.layout == 'page' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/tags.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/tags.css">
{% endif %}
{% if page.layout == 'category' or page.layout == 'tag' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/category-tag.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/category-tag.css">
{% endif %}
{% if page.title == 'Archives' and page.layout == 'page' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/archives.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/archives.css">
{% endif %}
{% if page.title == 'About' and page.layout == 'page' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/syntax.css" as="style">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/syntax.css">
{% endif %}
<!-- jquery --> <!-- jquery -->
<link rel="preload" as="script" <link rel="preload" as="script"
@ -130,22 +136,10 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if page.layout == 'post' %} {% if site.toc and page.toc and page.layout == 'post' %}
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/css/post.css"> <link rel="preload" as="script" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js">
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/css/syntax.css"> <script src="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js" async></script>
<script src="{{ site.baseurl }}/assets/js/dist/toc.min.js" async></script>
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/post.css">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/syntax.css">
{% if site.toc and page.toc %}
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css">
<link rel="preload" as="script" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css" />
<script src="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js" async></script>
<script src="{{ site.baseurl }}/assets/js/dist/toc.min.js" async></script>
{% endif %}
{% endif %} {% endif %}
<script src="{{ site.baseurl }}/assets/js/dist/tooltip-loader.min.js" async></script> <script src="{{ site.baseurl }}/assets/js/dist/tooltip-loader.min.js" async></script>

View File

@ -1,6 +1,4 @@
--- /*
---
/*!
* The main styles. * The main styles.
* v2.0 * v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy * https://github.com/cotes2020/jekyll-theme-chirpy
@ -66,8 +64,6 @@ body {
/*--- sidebar layout ---*/ /*--- sidebar layout ---*/
$tab-height: 3.3rem;
$tab-cursor-height: 1.6rem;
$tab-count: {{ site.data.tabs | size }}; $tab-count: {{ site.data.tabs | size }};
$sidebar-display: "sidebar-display"; $sidebar-display: "sidebar-display";

View File

@ -1,5 +1,3 @@
---
---
/* /*
* The syntax highlight. * The syntax highlight.
* v2.0 * v2.0

View File

@ -9,6 +9,9 @@
/*--- ↓ width and height ----*/ /*--- ↓ width and height ----*/
$tab-height: 3.3rem;
$tab-cursor-height: 1.6rem;
$sidebar-width-small: 210px; $sidebar-width-small: 210px;
$sidebar-width-medium: 260px; $sidebar-width-medium: 260px;
$sidebar-width-large: 350px; $sidebar-width-large: 350px;

View File

@ -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 {% include_relative _addon/main.scss %}
https://github.com/cotes2020/jekyll-theme-chirpy
© 2019 Cotes Chung
MIT License
*/
%date-timeline { %date-timeline {
content: ""; content: "";

View File

@ -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 {% include_relative _addon/main.scss %}
https://github.com/cotes2020/jekyll-theme-chirpy
© 2019 Cotes Chung
MIT License
*/
%category-icon-color { %category-icon-color {
color: gray; color: gray;

View File

@ -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 {% include_relative _addon/main.scss %}
https://github.com/cotes2020/jekyll-theme-chirpy
© 2019 Cotes Chung
MIT License
*/
@import "_addon/module";
#page-category, #page-tag { #page-category, #page-tag {
ul>li { ul>li {

View File

@ -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 { #post-list {
margin-top: 1rem; margin-top: 1rem;

10
assets/css/page.scss Normal file
View File

@ -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 %}

View File

@ -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 {% include_relative _addon/main.scss %}
https://github.com/cotes2020/jekyll-theme-chirpy {% include_relative _addon/syntax.scss %}
© 2019 Cotes Chung
MIT License
*/
@import "_addon/variables";
@import "_addon/module";
$prompt-older: "{{ site.data.label.post.button.previous }}"; $prompt-older: "{{ site.data.label.post.button.previous }}";
$prompt-newer: "{{ site.data.label.post.button.next }}"; $prompt-newer: "{{ site.data.label.post.button.next }}";

View File

@ -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 {% include_relative _addon/main.scss %}
* v2.0
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2019 Cotes Chung
* MIT License
*/
.tag { .tag {
border-radius: 0.7em; border-radius: 0.7em;