Theme

The look of a site is in site/modules/main/: XSLT views turn each page's XML document into HTML, and one stylesheet, built with Tailwind CSS, styles it. The theme works from 320 px to wide screens, in light and dark schemes and in print, and loads nothing from third-party addresses.

XSLT views

The configuration key document.transformer names the main view, main.xslt, in site/modules/main/transformers/. It includes the core's views of the modules share and user, then the site's own:

  • energine.xslt — the page: a skip link; the header with the site's name, the main menu, the language switcher and the sign-in link; main with the breadcrumbs and the content; a side column when the content template has a container named aside; the footer text.
  • sections.xslt — the eight sections of page templates.
  • ui.xslt — named templates for buttons (ui-button with the variants primary, plain and link), messages (ui-alert, ok or error) and section titles, and the shared class lists such as UI_CONTAINER for the page width.

The views are XSLT 1.0 with the EXSLT dyn functions. A site template overrides a core one with a higher priority. <head> comes from the core's document.xslt.

XSLT escapes output by default. Wherever the theme prints the owner's HTML unescaped, disable-output-escaping carries a comment d-o-e: <reason>; the repository's test tests/xslt-escaping.php fails on an unmarked one.

Stylesheets

Browsers load one file, stylesheets/main/main.css. It is built from site/modules/main/stylesheets/tailwind.css (Tailwind CSS v4) and kept in the repository, so a site runs without build tools: Tailwind is needed only to change the theme. tailwind.css imports theme.css, where the theme's variables are:

Variable Light What
--bg, --bg-soft #ffffff, #f4f5f7 page and soft backgrounds
--fg, --muted #1d2128, #5d6573 text and secondary text
--border #d9dde3 lines
--accent, --accent-fg #1f5fae, #ffffff the main colour and the text on it
--danger, --danger-bg, --ok-bg, --field-bg #b3261e, #fdecea, #e8f4ea, #ffffff errors, success, form fields
--radius .5rem corner radius
--wrap 72rem page width
--font system-ui and system fonts the font: system fonts or your own files, never third-party addresses

The dark scheme overrides the colours under @media (prefers-color-scheme: dark) and follows the visitor's system setting. Change the values, keep the names; keep the contrast of text and buttons at 4.5:1 or more in both schemes. tailwind.css maps the variables to Tailwind tokens such as bg-primary and text-muted, and takes its classes from the site's XSLT. Print styles give a white background, black text and links, and hide the menu, the tools and the forms' buttons.

Rebuild after a change:

bash ../private/energine/tools/get-tailwind.sh   # once per machine: Tailwind CSS v4 standalone, checked by its checksum
php index.php setup css

setup css builds main.css and the admin's admin.css; the repository's tests/css-build.sh fails when either differs from a fresh build of its source. The admin's styles are separate: they load only for administrators.

JavaScript

The scripts are plain ES modules without a build step. setup linker links every script into web/scripts/, and each page gets an import map of them: the module name is the path without .js, and the address carries the file's modification time. The site's own scripts go to site/modules/main/scripts/, which is linked to web/scripts/main/. A new script reaches the import map after php index.php setup linker; it must belong to the site's user. Components name their scripts in their configs (<javascript><behavior name="…"/>), and the empty template match="/" mode="scripts" in document.xslt is the place for your own.

The visual editor is Jodit, bundled with the core.