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="
crossorigin="anonymous">
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/css/main.css">
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin="anonymous">
@ -64,37 +62,45 @@
integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ="
crossorigin="anonymous">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/main.css">
{% if page.layout == 'home' %}
<link rel="preload" href="{{ site.baseurl }}/assets/css/home.css" as="style">
<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 %}
{% 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 -->
<link rel="preload" as="script"
@ -130,22 +136,10 @@
{% endif %}
{% endif %}
{% if page.layout == 'post' %}
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/css/post.css">
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/css/syntax.css">
<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 %}
{% if site.toc and page.toc and page.layout == 'post' %}
<link rel="preload" as="script" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js">
<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 %}
<script src="{{ site.baseurl }}/assets/js/dist/tooltip-loader.min.js" async></script>

View file

@ -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";

View file

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

View file

@ -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;

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

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 {
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
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 }}";

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