Markdown Overview Buttons Tabs Footnotes Collapse ToC Navigation Formula Page-Specific Meta Custom Components
The afterBuild
config allows you to add functions (called hooks) that will be invoked after the build process is finished:
1linkimport { configuration } from '@codedoc/core';
2link
3link//...
4link
5linkexport const config = /*#__PURE__*/configuration({
6link //...
7link afterBuild: [
8link function logFinished() {
9link console.log('Build Finished!!!!');
10link }
11link ],
12link //...
13link});
touch_app NOTE
It is highly recommended to use named functions (and not arrow functions) as hooks. CODEDOC will log the name of each hook it is running, so providing a name makes it easy to track and debug hooks.
An after-build hook can also be asynchronous.CODEDOC will wait for each hook to finish before it executes the next hook (or deems the build process complete).
Each after-build hook will also be passed a Build
object, which contains information about the build that just
concluded:
1linkimport { configuration, Build, CodedocConfig } from '@codedoc/core';
2link
3link//...
4link
5linkexport const config = /*#__PURE__*/configuration({
6link //...
7link afterBuild: [
8link async function hook(build: Build<CodedocConfig>) {
9link ...
10link }
11link ],
12link //...
13link});
Any Build
object has the following properties:
config
:
The (final) configuration used for the build.
partial
:
Whether the build was partial or complete. For example, on local development only partial builds
are conducted (limited to markdown files that have changed).
source
:
The source (markdown) files that were used. This is an RxLine Line
object,
containing unpopulated RxLine File
s, each
containing the following properties:
root
: the root search path the file was obtained frompath
: the path of the file relative to root search pathbuilt
:
An array of RxLine File
s, each containing
the following properties:
root
: the root path for all generated HTML filespath
: path of the particular file relative to root
content
: HTML string content of the file