Skip to content

Commit

Permalink
explain structure of UI bundle in more detail
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Aug 6, 2022
1 parent a6e13a2 commit b69fe53
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,13 @@ Since these optimizations are only applied to the pre-compiled files, they don't

== UI compilation and generator consumption overview

The purpose of an Antora UI project is to get the UI files into a state that Antora can use and to make it reusable.
The only required file in the UI bundle is the default layout for pages (i.e., [.path]_layouts/default.hbs_) (and the layout for the 404 page, [.path]_layouts/404.hbs_ if the 404 page is enabled).
The purpose of an Antora UI project is to assemble the UI files into a reusable distribution that Antora can use to compose the HTML pages and the assets they require.

The only required file in the UI bundle is the default Handlebars layout for pages (i.e., [.path]_layouts/default.hbs_).
If the 404 page is enabled, the Handlebars layout for the 404 page is also required (i.e., [.path]_layouts/404.hbs_).

The layout files must be located in the [.path]_layouts_ folder in the UI bundle.
The name of the layout is the stem of the file, which is the file's basename with a file extension (e.g., [.path]_layouts/default.hbs_ becomes `default`).

[.output]
....
Expand All @@ -180,7 +185,28 @@ layouts/
default.hbs
....

Any additional files are only required because they are used by this layout, either when generating the HTML or assets referenced by the HTML that are served to the browser.
There are no other required files in a UI bundle.
Any additional files are only required because they are referenced by a layout, either when generating the HTML (partial or helper) or assets referenced by the HTML (CSS or JavaScript) that are served to the browser.
Antora does not copy layouts, partials, or helpers to the generated site.

If the layout looks for a partial, that partial must be located in the [.path]_partials_ directory.
The name of the partial is the stem of the file (e.g,. [.path]_partials/body.hbs_] becomes `body` and used as `> body`).
If the partial is inside a folder, the name of that folder is not used in the partial's name.
Additionally, any JavaScript files found in the [.path]_helpers_ directory are automatically registered as template helpers.
The name of the helper function matches the stem of the file (e.g., [.path]_heleprs/concat.js_ becomes `concat`).

Here's how a UI would be structured if it had layouts, partials, and helpers:

[.output]
....
helpers/
concat.js
layouts/
404.hbs
default.hbs
partials/
body.hbs
....

The UI is served statically in a production site, but the UI's assets live in a source form in a UI project to accommodate development and simplify maintenance.
When handed off to the Antora pipeline, the UI is in an interim, pre-compiled state.
Expand Down

0 comments on commit b69fe53

Please sign in to comment.