Skip to content

Commit 30b206b

Browse files
committed
perf: Replace Font Awesome with inline svg icons
Font Awesome shipped 137 kB of css and eight webfont files for seven glyphs: the external-link arrow, the search magnifier, the glossary link icon and four social icons in the footer. Those are inline svgs now (path data from Font Awesome Free 6.2.1, CC BY 4.0, attributed in ui/NOTICE), sized and colored via a small .svg-icon utility class. site.css shrinks from 146 kB to 48 kB and the webfonts/ directory disappears from the bundle. The fa-* checklist selectors in doc.css stay: they come from upstream and draw the check marks with css content, independent of any icon font. Also removes the inlineDynamicImports rollup option (vite 8 warns it is redundant for non-code-split builds).
1 parent ebb98f1 commit 30b206b

21 files changed

Lines changed: 28 additions & 7969 deletions

antora-playbook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ asciidoc:
311311
attributes:
312312
base-repo: https://github.com/stackabletech
313313
# an external icon. Create a link opening in a new tab like this: http://my-url.com[Text {external-link-icon}^]
314-
external-link-icon: "<i class=\"fa-solid fa-arrow-up-right-from-square fa-xs\" style=\"margin-left: 3px; vertical-align: baseline;\"></i>"
314+
external-link-icon: "<svg class=\"svg-icon\" style=\"width: 0.75em; height: 0.75em; margin-left: 3px;\" viewBox=\"0 0 512 512\" aria-hidden=\"true\"><path d=\"M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32h82.7L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V32c0-17.7-14.3-32-32-32H320zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z\"/></svg>"
315315
# the default caching directory is ./.cache/antora
316316
# Antora caches the git repos, this can sometimes lead to stale content
317317
# use 'make clean' to remove the build and cache directory

local-antora-playbook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ asciidoc:
296296
attributes:
297297
base-repo: https://github.com/stackabletech
298298
# an external icon. Create a link opening in a new tab like this: http://my-url.com[Text {external-link-icon}^]
299-
external-link-icon: "<i class=\"fa-solid fa-arrow-up-right-from-square fa-xs\" style=\"margin-left: 3px; vertical-align: baseline;\"></i>"
299+
external-link-icon: "<svg class=\"svg-icon\" style=\"width: 0.75em; height: 0.75em; margin-left: 3px;\" viewBox=\"0 0 512 512\" aria-hidden=\"true\"><path d=\"M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32h82.7L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V32c0-17.7-14.3-32-32-32H320zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z\"/></svg>"
300300
# the default caching directory is ./.cache/antora
301301
# Antora caches the git repos, this can sometimes lead to stale content
302302
# use 'make clean' to remove the build and cache directory

modules/reference/pages/glossary.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
= Glossary
2-
:li: pass:[<i class="fa-solid fa-link fa-sm" style="margin-left: 5px; vertical-align: baseline;"></i>]
2+
:li: pass:[<svg class="svg-icon" style="width: 0.875em; height: 0.875em; margin-left: 5px;" viewBox="0 0 640 512" aria-hidden="true"><path d="M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z"/></svg>]
33
:description: Glossary of Stackable terms, including Role, Role Group, and Stacklet, with definitions and links to detailed explanations.
44

55
// refined styling for the glossary

only-dev-antora-playbook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ asciidoc:
107107
attributes:
108108
base-repo: https://github.com/stackabletech
109109
# an external icon. Create a link opening in a new tab like this: http://my-url.com[Text {external-link-icon}^]
110-
external-link-icon: "<i class=\"fa-solid fa-arrow-up-right-from-square fa-xs\" style=\"margin-left: 3px; vertical-align: baseline;\"></i>"
110+
external-link-icon: "<svg class=\"svg-icon\" style=\"width: 0.75em; height: 0.75em; margin-left: 3px;\" viewBox=\"0 0 512 512\" aria-hidden=\"true\"><path d=\"M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32h82.7L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V32c0-17.7-14.3-32-32-32H320zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z\"/></svg>"
111111
# the default caching directory is ./.cache/antora
112112
# Antora caches the git repos, this can sometimes lead to stale content
113113
# use 'make clean' to remove the build and cache directory

supplemental-ui/partials/navbar.hbs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<a class="navbar-item" href="{{{ relativize (versioned "home" page "reference/index.html") }}}">CRD Reference</a>
1919
{{else}}
2020
<a class="navbar-item" href="{{{ page.attributes.crd-docs }}}" target="_blank">
21-
CRD Reference <i class="fa-solid fa-arrow-up-right-from-square fa-sm" style="margin-left: 5px;"></i>
21+
CRD Reference <svg class="svg-icon" style="width: 0.875em; height: 0.875em; margin-left: 5px;" viewBox="0 0 512 512" aria-hidden="true"><path d="M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32h82.7L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V32c0-17.7-14.3-32-32-32H320zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z"/></svg>
2222
</a>
2323
{{/if}}
2424
<hr class="navbar-divider">
@@ -95,13 +95,13 @@
9595
<a class="navbar-link" href="#">Community</a>
9696
<div class="navbar-dropdown">
9797
<a class="navbar-item" href="https://stackable.tech/en/" target="_blank">
98-
Homepage <i class="fa-solid fa-arrow-up-right-from-square fa-sm" style="margin-left: 5px;"></i>
98+
Homepage <svg class="svg-icon" style="width: 0.875em; height: 0.875em; margin-left: 5px;" viewBox="0 0 512 512" aria-hidden="true"><path d="M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32h82.7L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V32c0-17.7-14.3-32-32-32H320zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z"/></svg>
9999
</a>
100100
<a class="navbar-item" href="https://github.com/stackabletech/" target="_blank">
101-
GitHub <i class="fa-solid fa-arrow-up-right-from-square fa-sm" style="margin-left: 5px;"></i>
101+
GitHub <svg class="svg-icon" style="width: 0.875em; height: 0.875em; margin-left: 5px;" viewBox="0 0 512 512" aria-hidden="true"><path d="M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32h82.7L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V32c0-17.7-14.3-32-32-32H320zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z"/></svg>
102102
</a>
103103
<a class="navbar-item" href="https://discord.com/invite/7kZ3BNnCAF" target="_blank">
104-
Discord <i class="fa-solid fa-arrow-up-right-from-square fa-sm" style="margin-left: 5px;"></i>
104+
Discord <svg class="svg-icon" style="width: 0.875em; height: 0.875em; margin-left: 5px;" viewBox="0 0 512 512" aria-hidden="true"><path d="M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32h82.7L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V32c0-17.7-14.3-32-32-32H320zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z"/></svg>
105105
</a>
106106
<hr class="navbar-divider">
107107
<a class="navbar-item" href="{{{ relativize (versioned "home" page "contributor/index.html") }}}">Contributing</a>

truly-local-playbook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ asciidoc:
7272
attributes:
7373
base-repo: https://github.com/stackabletech
7474
# an external icon. Create a link opening in a new tab like this: http://my-url.com[Text {external-link-icon}^]
75-
external-link-icon: "<i class=\"fa-solid fa-arrow-up-right-from-square fa-xs\" style=\"margin-left: 3px; vertical-align: baseline;\"></i>"
75+
external-link-icon: "<svg class=\"svg-icon\" style=\"width: 0.75em; height: 0.75em; margin-left: 3px;\" viewBox=\"0 0 512 512\" aria-hidden=\"true\"><path d=\"M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32h82.7L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V32c0-17.7-14.3-32-32-32H320zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z\"/></svg>"
7676
# the default caching directory is ./.cache/antora
7777
# Antora caches the git repos, this can sometimes lead to stale content
7878
# use 'make clean' to remove the build and cache directory

ui/NOTICE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ header comments; this file preserves the attributions and is included
99
in the published bundle.
1010

1111
- Font Awesome Free 6.2.1 (https://fontawesome.com)
12-
Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License
13-
https://fontawesome.com/license/free
12+
The inline svg icon path data is derived from Font Awesome Free icons
13+
(CC BY 4.0). https://fontawesome.com/license/free
1414
- highlight.js (https://highlightjs.org)
1515
BSD 3-Clause License, (c) 2006 Ivan Sagalaev and contributors
1616
- Asciidoctor Tabs (https://github.com/asciidoctor/asciidoctor-tabs)

ui/build.mjs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Builds the Antora UI bundle (https://docs.antora.org/antora-ui-default/):
2-
// css/, js/, js/vendor/, font/, webfonts/, img/, helpers/, layouts/, partials/
2+
// css/, js/, js/vendor/, font/, img/, helpers/, layouts/, partials/
33
// zipped as build/ui-bundle.zip (the path the playbooks reference).
44
//
55
// The scripts are consumed as classic <script src> tags, so every js entry is
@@ -69,7 +69,6 @@ for (const entry of jsEntries) {
6969
output: {
7070
format: 'iife',
7171
entryFileNames: `js/${entry.name}.js`,
72-
inlineDynamicImports: true
7372
}
7473
}
7574
}
@@ -89,7 +88,6 @@ await build(
8988
assetFileNames: (asset) => {
9089
const name = asset.names[0] ?? '';
9190
if (name === 'site.css') return 'css/site.css';
92-
if (/^fa-.+\.(woff2?|ttf)$/.test(name)) return 'webfonts/[name][extname]';
9391
if (/\.(woff2?|ttf)$/.test(name)) return 'font/[name][extname]';
9492
if (/\.(svg|png|gif|ico|jpg)$/.test(name)) return 'img/[name][extname]';
9593
return 'css/[name][extname]';
@@ -100,9 +98,7 @@ await build(
10098
})
10199
);
102100

103-
// webfonts/ ships as-is: the Font Awesome css references it with
104-
// runtime-relative urls that vite cannot (and must not) rewrite
105-
for (const dir of ['helpers', 'layouts', 'partials', 'img', 'webfonts']) {
101+
for (const dir of ['helpers', 'layouts', 'partials', 'img']) {
106102
cpSync(resolve(src, dir), resolve(staged, dir), { recursive: true });
107103
}
108104
for (const file of ['NOTICE', 'LICENSE']) {

ui/src/css/base.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,13 @@ body ::-webkit-scrollbar-thumb {
148148
.justify-between {
149149
justify-content: space-between;
150150
}
151+
152+
/* Inline svg icons; the path data comes from Font Awesome Free (CC BY 4.0,
153+
* see ../../NOTICE). Sizes deviating from 1em are set inline at the usage. */
154+
.svg-icon {
155+
display: inline-block;
156+
width: 1em;
157+
height: 1em;
158+
fill: currentcolor;
159+
vertical-align: -0.125em;
160+
}

ui/src/css/site.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@
1919
@import "admonition.css";
2020
@import "end-of-life-banner.css";
2121
@import "link-bar.css";
22-
@import "vendor/fontawesome.css";
2322
@import "@asciidoctor/tabs/dist/css/tabs.css";
2423
@import "tabs.css";

0 commit comments

Comments
 (0)