Skip to content

Commit 39acdbf

Browse files
committed
feat(typography): use responsive fonts
1 parent 19f37ca commit 39acdbf

4 files changed

Lines changed: 29 additions & 19 deletions

File tree

gulpfile.babel.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import postcss from "gulp-postcss";
88
import magician from "postcss-font-magician";
99
import cssnano from "cssnano";
1010
import postcssPresetEnv from "postcss-preset-env";
11+
import rfs from "rfs";
1112
import concat from "gulp-concat";
1213

1314
const browserSync = browserSyncCreate();
@@ -86,6 +87,7 @@ const compileCSS = () => {
8687
// postcssPresetEnv comes with autoprefixer
8788
postcssPresetEnv({ stage: 1 }),
8889
magician({}),
90+
rfs(),
8991
cssnano()
9092
];
9193
return src([

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"postcss-font-magician": "^2.3.1",
1717
"postcss-preset-env": "^6.7.0",
1818
"recess": "^1.1.9",
19+
"rfs": "^9.0.2",
1920
"semantic-release": "^15.13.31"
2021
},
2122
"config": {

static/css/typography.css

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,22 @@ ul.list-articles-under-tag-category li time {
4343
font-family: var(--sansFontFamily);
4444
}
4545
h1 {
46-
font-size: 2.4rem;
46+
font-size: rfs(2.4rem);
4747
}
4848
h2 {
49-
font-size: 2.2rem;
49+
font-size: rfs(2.2rem);
5050
}
5151
h3 {
52-
font-size: 2rem;
52+
font-size: rfs(2rem);
5353
}
5454
h4 {
55-
font-size: 1.8rem;
55+
font-size: rfs(1.8rem);
5656
}
5757
h5 {
58-
font-size: 1.6rem;
58+
font-size: rfs(1.6rem);
5959
}
6060
h6 {
61-
font-size: 1.4rem;
61+
font-size: rfs(1.4rem);
6262
}
6363
h1,
6464
h2,
@@ -67,21 +67,21 @@ h3 {
6767
border-bottom: var(--headingBorderBottomWidth) var(--headingBorderBottomStyle)
6868
lightgray;
6969
& code {
70-
font-size: 80%;
70+
font-size: rfs(80%);
7171
}
7272
& small {
73-
font-size: 70%;
73+
font-size: rfs(70%);
7474
}
7575
}
7676
h4,
7777
h5,
7878
h6 {
7979
line-height: 1.1em;
8080
& code {
81-
font-size: 80%;
81+
font-size: rfs(80%);
8282
}
8383
& small {
84-
font-size: 80%;
84+
font-size: rfs(80%);
8585
}
8686
}
8787
h1 small,
@@ -118,7 +118,7 @@ h1#recent-posts {
118118
}
119119
section#article-sidebar h4,
120120
nav h4 {
121-
font-size: var(--headingOthersH4FontSize);
121+
font-size: rfs(var(--headingOthersH4FontSize));
122122
line-height: var(--headingOthersLineHeight);
123123
}
124124
/* code */
@@ -133,16 +133,16 @@ pre,
133133
code,
134134
pre,
135135
.literal /* reST */ {
136-
font-size: 0.9rem;
136+
font-size: rfs(0.9rem);
137137
}
138138
.brand .site-name {
139-
font-size: 1.5rem;
139+
font-size: rfs(1.5rem);
140140
vertical-align: middle;
141141
}
142142
/* article */
143143
.article-content,
144144
div.recent-posts p {
145-
font-size: 1.125rem;
145+
font-size: rfs(1.125rem);
146146
font-family: var(--serifFontFamily);
147147
font-weight: 400;
148148
line-height: 1.6;
@@ -156,7 +156,7 @@ blockquote {
156156
}
157157
}
158158
a.category-title-inside-accordion {
159-
font-size: 1.1rem;
159+
font-size: rfs(1.1rem);
160160
}
161161
.author-name {
162162
font-weight: bold;
@@ -170,7 +170,7 @@ div.blog-archives div,
170170
div.recent-posts-article,
171171
ul.list-articles-under-tag-category li {
172172
font-family: var(--sansFontFamily);
173-
font-size: 0.963rem;
173+
font-size: rfs(0.963rem);
174174
}
175175
.proj-desc,
176176
footer,
@@ -179,12 +179,12 @@ div.recent-posts time,
179179
ul.list-articles-under-tag-category li time,
180180
div.recent-posts-posted {
181181
font-family: var(--sansFontFamily);
182-
font-size: 0.8rem;
182+
font-size: rfs(0.8rem);
183183
}
184184
span.superscript {
185-
font-size: 0.67rem;
185+
font-size: rfs(0.67rem);
186186
vertical-align: super;
187187
}
188188
.navbar .nav > li > a {
189-
font-size: 1rem;
189+
font-size: rfs(1rem);
190190
}

yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7687,6 +7687,13 @@ reusify@^1.0.0:
76877687
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
76887688
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==
76897689

7690+
rfs@^9.0.2:
7691+
version "9.0.2"
7692+
resolved "https://registry.yarnpkg.com/rfs/-/rfs-9.0.2.tgz#3561013d529e4cbeb5839bd7a6b4e2fa48a54a28"
7693+
integrity sha512-reBlIf8GuC3h6LgpEWMCjGUwo7kNgNNnxhX6yTEHD4NEjg4gsVoWyqJ8rdNYjD2KFWxBqAmfuFIQcuaKNY0Oqg==
7694+
dependencies:
7695+
postcss-value-parser "^4.0.2"
7696+
76907697
rgb-regex@^1.0.1:
76917698
version "1.0.1"
76927699
resolved "https://registry.yarnpkg.com/rgb-regex/-/rgb-regex-1.0.1.tgz#c0e0d6882df0e23be254a475e8edd41915feaeb1"

0 commit comments

Comments
 (0)