Commit f84301a
committed
Optionally pre-render the Graphviz diagrams
Since the WebAssembly version of Graphviz is not exactly light (1.4MB at
the time of writing), and since it is a waste to let everybody re-render
the SVG client-side over and over again even though the diagram's
definition hasn't changed, let's add a script that performs that
rendering "on the server side" (more precisely: during deployment).
This script takes no arguments and post-processes the output of Hugo in
`public/`.
For performance reasons, it requires the list of files that contain
Graphviz diagrams. With this here site, it might not matter much because
there are only a handful images here. However, I want to reuse the same
method on git-scm.com where there _are_ thousands of files that do not
contain any Graphviz diagrams, and therefore it is a necessary
optimization to process only the files that _do_ contain Graphviz
diagrams.
To get that list, a new layout and page are added that Hugo processes,
identifyng said list of files and writing the result to
`public/diagram-list.html`.
Since this script runs via Node.JS and therefore lacks the convenient
built-in HTML parser of browser-based JavaScript engines, a prerequisite
is now to run `npm install` so that the `node-html-parser` package is
available.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>1 parent 5370634 commit f84301a
File tree
5 files changed
+197
-0
lines changed- content
- layouts
- script
5 files changed
+197
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
0 commit comments