Skip to content

Commit 290d151

Browse files
notriddleehuss
authored andcommitted
Use embedded SVG instead of fonts for icons
The [downsides of icon fonts] are well-documented, and also, why ship all of the icons when it only uses 14? [downsides of icon fonts]: https://speakerdeck.com/ninjanails/death-to-icon-fonts
1 parent 8befcc7 commit 290d151

24 files changed

+221
-2762
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ clap = { version = "4.5.41", features = ["cargo", "wrap_help"] }
3333
clap_complete = "4.5.55"
3434
elasticlunr-rs = "3.0.2"
3535
env_logger = "0.11.8"
36+
font-awesome-as-a-crate = "0.3.0"
3637
futures-util = "0.3.31"
3738
handlebars = "6.3.2"
3839
hex = "0.4.3"

crates/mdbook-html/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ rust-version.workspace = true
1111
ammonia = { workspace = true, optional = true }
1212
anyhow.workspace = true
1313
elasticlunr-rs = { workspace = true, optional = true }
14+
font-awesome-as-a-crate.workspace = true
1415
handlebars.workspace = true
1516
hex.workspace = true
1617
log.workspace = true

crates/mdbook-html/front-end/css/chrome.css

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ html.sidebar-visible #menu-bar {
5656
#menu-bar.bordered {
5757
border-block-end-color: var(--table-border-color);
5858
}
59-
#menu-bar i, #menu-bar .icon-button {
59+
#menu-bar .fa-svg, #menu-bar .icon-button {
6060
position: relative;
6161
padding: 0 8px;
6262
z-index: 10;
@@ -65,7 +65,7 @@ html.sidebar-visible #menu-bar {
6565
transition: color 0.5s;
6666
}
6767
@media only screen and (max-width: 420px) {
68-
#menu-bar i, #menu-bar .icon-button {
68+
#menu-bar .fa-svg, #menu-bar .icon-button {
6969
padding: 0 5px;
7070
}
7171
}
@@ -76,7 +76,7 @@ html.sidebar-visible #menu-bar {
7676
padding: 0;
7777
color: inherit;
7878
}
79-
.icon-button i {
79+
.icon-button .fa-svg {
8080
margin: 0;
8181
}
8282

@@ -118,14 +118,14 @@ html:not(.js) .left-buttons button {
118118
.mobile-nav-chapters,
119119
.mobile-nav-chapters:visited,
120120
.menu-bar .icon-button,
121-
.menu-bar a i {
121+
.menu-bar a .fa-svg {
122122
color: var(--icons);
123123
}
124124

125-
.menu-bar i:hover,
125+
.menu-bar .fa-svg:hover,
126126
.menu-bar .icon-button:hover,
127127
.nav-chapters:hover,
128-
.mobile-nav-chapters i:hover {
128+
.mobile-nav-chapters .fa-svg:hover {
129129
color: var(--icons-hover);
130130
}
131131

@@ -244,7 +244,7 @@ pre > .buttons :hover {
244244
border-color: var(--icons-hover);
245245
background-color: var(--theme-hover);
246246
}
247-
pre > .buttons i {
247+
pre > .buttons .fa-svg {
248248
margin-inline-start: 8px;
249249
}
250250
pre > .buttons button {

crates/mdbook-html/front-end/css/font-awesome.min.css

Lines changed: 0 additions & 4 deletions
This file was deleted.

crates/mdbook-html/front-end/css/general.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,10 @@ sup {
278278
.result-no-output {
279279
font-style: italic;
280280
}
281+
282+
.fa-svg svg {
283+
width: 1em;
284+
height: 1em;
285+
fill: currentColor;
286+
margin-bottom: -0.1em;
287+
}
Binary file not shown.
Binary file not shown.

crates/mdbook-html/front-end/fonts/fontawesome-webfont.svg

Lines changed: 0 additions & 2671 deletions
This file was deleted.
Binary file not shown.

0 commit comments

Comments
 (0)