Skip to content

Commit b0017a6

Browse files
committed
Improved loading performance by merging CSS files.
1 parent fec448d commit b0017a6

11 files changed

Lines changed: 94 additions & 92 deletions

File tree

_includes/head.html

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@
5353
integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ="
5454
crossorigin="anonymous">
5555

56-
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/css/main.css">
57-
5856
<link rel="stylesheet"
5957
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
6058
integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin="anonymous">
@@ -64,38 +62,46 @@
6462
integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ="
6563
crossorigin="anonymous">
6664

67-
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/main.css">
68-
6965
{% if page.layout == 'home' %}
7066
<link rel="preload" href="{{ site.baseurl }}/assets/css/home.css" as="style">
7167
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/home.css">
72-
{% endif %}
7368

74-
{% if page.title == 'Categories' and page.layout == 'page' %}
75-
<link rel="preload" href="{{ site.baseurl }}/assets/css/categories.css" as="style">
76-
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/categories.css">
77-
{% endif %}
69+
{% elsif page.layout == 'page' %}
7870

79-
{% if page.title == 'Tags' and page.layout == 'page' %}
80-
<link rel="preload" href="{{ site.baseurl }}/assets/css/tags.css" as="style">
81-
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/tags.css">
82-
{% endif %}
71+
{% if page.title == 'Categories' %}
72+
<link rel="preload" href="{{ site.baseurl }}/assets/css/categories.css" as="style">
73+
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/categories.css">
8374

84-
{% if page.layout == 'category' or page.layout == 'tag' %}
85-
<link rel="preload" href="{{ site.baseurl }}/assets/css/category-tag.css" as="style">
86-
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/category-tag.css">
87-
{% endif %}
75+
{% elsif page.title == 'Tags' %}
76+
<link rel="preload" href="{{ site.baseurl }}/assets/css/tags.css" as="style">
77+
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/tags.css">
8878

89-
{% if page.title == 'Archives' and page.layout == 'page' %}
90-
<link rel="preload" href="{{ site.baseurl }}/assets/css/archives.css" as="style">
91-
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/archives.css">
92-
{% endif %}
79+
{% elsif page.title == 'Archives' %}
80+
<link rel="preload" href="{{ site.baseurl }}/assets/css/archives.css" as="style">
81+
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/archives.css">
82+
83+
{% else %}
84+
<link rel="preload" href="{{ site.baseurl }}/assets/css/page.css" as="style">
85+
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/page.css">
86+
87+
{% endif %}
88+
89+
{% elsif page.layout == 'category' or page.layout == 'tag' %}
90+
<link rel="preload" href="{{ site.baseurl }}/assets/css/category-tag.css" as="style">
91+
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/category-tag.css">
92+
93+
{% elsif page.layout == 'post' %}
94+
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/css/post.css">
95+
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/post.css">
96+
97+
{% if site.toc and page.toc %}
98+
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css">
99+
<link rel="stylesheet" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css" />
100+
{% endif %}
93101

94-
{% if page.title == 'About' and page.layout == 'page' %}
95-
<link rel="preload" href="{{ site.baseurl }}/assets/css/syntax.css" as="style">
96-
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/syntax.css">
97102
{% endif %}
98103

104+
99105
<!-- jquery -->
100106
<link rel="preload" as="script"
101107
href="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"
@@ -130,22 +136,10 @@
130136
{% endif %}
131137
{% endif %}
132138

133-
{% if page.layout == 'post' %}
134-
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/css/post.css">
135-
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/css/syntax.css">
136-
137-
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/post.css">
138-
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/syntax.css">
139-
140-
{% if site.toc and page.toc %}
141-
<link rel="preload" as="style" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css">
142-
<link rel="preload" as="script" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js">
143-
144-
<link rel="stylesheet" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css" />
145-
<script src="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js" async></script>
146-
<script src="{{ site.baseurl }}/assets/js/dist/toc.min.js" async></script>
147-
{% endif %}
148-
139+
{% if site.toc and page.toc and page.layout == 'post' %}
140+
<link rel="preload" as="script" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js">
141+
<script src="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js" async></script>
142+
<script src="{{ site.baseurl }}/assets/js/dist/toc.min.js" async></script>
149143
{% endif %}
150144

151145
<script src="{{ site.baseurl }}/assets/js/dist/tooltip-loader.min.js" async></script>
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
---
2-
---
3-
/*!
1+
/*
42
* The main styles.
53
* v2.0
64
* https://github.com/cotes2020/jekyll-theme-chirpy
@@ -66,8 +64,6 @@ body {
6664

6765
/*--- sidebar layout ---*/
6866

69-
$tab-height: 3.3rem;
70-
$tab-cursor-height: 1.6rem;
7167
$tab-count: {{ site.data.tabs | size }};
7268

7369
$sidebar-display: "sidebar-display";
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
---
2-
---
31
/*
42
* The syntax highlight.
53
* v2.0

assets/css/_addon/variables.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
/*--- ↓ width and height ----*/
1111

12+
$tab-height: 3.3rem;
13+
$tab-cursor-height: 1.6rem;
14+
1215
$sidebar-width-small: 210px;
1316
$sidebar-width-medium: 260px;
1417
$sidebar-width-large: 350px;

assets/css/archives.scss

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
---
2+
# Style for Archives
3+
# v2.0
4+
# https://github.com/cotes2020/jekyll-theme-chirpy
5+
# © 2019 Cotes Chung
6+
# MIT License
27
---
3-
/*!
4-
Style for Archives
5-
v2.0
6-
https://github.com/cotes2020/jekyll-theme-chirpy
7-
© 2019 Cotes Chung
8-
MIT License
9-
*/
8+
9+
10+
{% include_relative _addon/main.scss %}
1011

1112
%date-timeline {
1213
content: "";

assets/css/categories.scss

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
---
2+
# Style for Tab Categories
3+
# v2.0
4+
# https://github.com/cotes2020/jekyll-theme-chirpy
5+
# © 2019 Cotes Chung
6+
# MIT License
27
---
3-
/*!
4-
Style for Tab Categories
5-
v2.0
6-
https://github.com/cotes2020/jekyll-theme-chirpy
7-
© 2019 Cotes Chung
8-
MIT License
9-
*/
8+
9+
10+
{% include_relative _addon/main.scss %}
1011

1112
%category-icon-color {
1213
color: gray;

assets/css/category-tag.scss

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2+
# Style for page Category and Tag
3+
# v2.0
4+
# https://github.com/cotes2020/jekyll-theme-chirpy
5+
# © 2019 Cotes Chung
6+
# MIT License
27
---
3-
/*!
4-
Style for page Category and Tag
5-
v2.0
6-
https://github.com/cotes2020/jekyll-theme-chirpy
7-
© 2019 Cotes Chung
8-
MIT License
9-
*/
10-
@import "_addon/module";
8+
9+
10+
{% include_relative _addon/main.scss %}
1111

1212
#page-category, #page-tag {
1313
ul>li {

assets/css/home.scss

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
2+
# Style for Homepage
3+
# v2.0
4+
# https://github.com/cotes2020/jekyll-theme-chirpy
5+
# © 2019 Cotes Chung
6+
# MIT License
27
---
3-
/*!
4-
Style for Homepage
5-
v2.0
6-
https://github.com/cotes2020/jekyll-theme-chirpy
7-
© 2019 Cotes Chung
8-
MIT License
9-
*/
108

9+
{% include_relative _addon/main.scss %}
1110

1211
#post-list {
1312
margin-top: 1rem;

assets/css/page.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
# The default style for layout Page
3+
# v2.2
4+
# https://github.com/cotes2020/jekyll-theme-chirpy
5+
# © 2020 Cotes Chung
6+
# MIT License
7+
---
8+
9+
{% include_relative _addon/main.scss %}
10+
{% include_relative _addon/syntax.scss %}

assets/css/post.scss

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2+
# Post-specific style
3+
# v2.0
4+
# https://github.com/cotes2020/jekyll-theme-chirpy
5+
# © 2019 Cotes Chung
6+
# MIT License
27
---
3-
/*!
4-
Post-specific style
5-
v2.0
6-
https://github.com/cotes2020/jekyll-theme-chirpy
7-
© 2019 Cotes Chung
8-
MIT License
9-
*/
10-
@import "_addon/variables";
11-
@import "_addon/module";
8+
9+
10+
{% include_relative _addon/main.scss %}
11+
{% include_relative _addon/syntax.scss %}
1212

1313
$prompt-older: "{{ site.data.label.post.button.previous }}";
1414
$prompt-newer: "{{ site.data.label.post.button.next }}";

0 commit comments

Comments
 (0)