Theme packages
A theme can come as a package. Then a new look for one site needs no engine release. Building a theme says what goes in it.
The package
A package is a zip of at most 20 MB. Its root holds these files:
THEMEis JSON, such as{"key": "example", "version": "1.0.0", "engine": ">=1.2.0"}.keyuses only[a-z0-9_-]. It is unique across Lightbolt: a key another organisation has is refused.versionis MAJOR.MINOR.PATCH.engineis optional. It takes>=,>,=,^or~.
MANIFEST.sha256holds a hash of every file.
THEME can also hold two optional keys:
presetsare the choices that the admin offers in the field Classes. They are per kind:menu_item,section,rowandpage. Each has alabelper language, andclassesper slot.displaysays what the theme has a place for. It is per kind and per column. The kind isblog,recordsfor every module, or the key of a module. The column islistoritem. An example is{"blog": {"item": ["image", "date", "author"]}, "records": {"item": ["image", "f:*"]}}.- The keys are the same as
displayin GET entries.f:*andr:*mean every field or every relation. - Under What it shows, the admin greys out the rest, and says why. What someone chose there stays.
- A kind or column that is not named shows everything.
- The keys are the same as
Uploading
Upload it in Lightbolt under Organisation → Themes, or from a pipeline:
POST /delivery/v1/themes
Authorization: Bearer lbt_…
(the zip as the body, or as the form field "theme")| Answer | What it means |
|---|---|
201 |
It worked. The answer has key, version, engine, sha256 and bytes. |
422 with error |
THEME or MANIFEST.sha256 is missing, the version exists with other files, or the zip is wrong. |
The very same zip again gives back the version that is there. So a pipeline can run again safely.
You can also choose it in the same call. Add ?site=<id>&environment=<name>. Then the version is also chosen for that environment, when the token may do that. That is a token made under Repositories, or a token for those environments.
- Then
201also haschosen: {site, environment}. - When it could not be chosen, you get
409witherror, such as Uploaded, but not chosen: …. So the pipeline turns red.
Themes from Bitbucket gives a whole setup per site.
Your own pipeline, with tags
The usual way is a repository that Lightbolt makes or links. Every push to a branch builds the theme, and puts it on the environment of that branch. See Themes from Bitbucket or GitHub.
A pipeline of your own can work differently. The example of the frontend, tools/bitbucket-pipelines.example.yml, works like this:
- You push a tag like
theme-sunrise-1.0.1. That builds the package withphp tools/build-theme.php <theme folder> <version> "<engine rule>". Then it posts the package toPOST /delivery/v1/themes, withoutsiteandenvironment. - It needs two secured repository variables:
LIGHTBOLT_CMSis the address of Lightbolt.LIGHTBOLT_UPLOAD_TOKENis a pipeline key,lbt_…, from Organisation → Themes → Pipeline keys. Never put the token in the repository.
- Such an upload only stores the version. Choose it under Theme → Theme version of the site. Choose it for staging first, check it, and then choose it for live.
- The engine rule of the example,
">=1.5.0", is a placeholder. Set your own. - Outside the repository of the frontend,
build-theme.phpneeds the parent themes, to merge in their presets. Add--parents=<folder with theme folders>, such asengine/themesof the dev kit. Without them, it builds anyway, and says that the presets of the parents are missing.
The engine rule is engine in THEME. It is the oldest engine that the theme works with, such as ">=1.137.0". A frontend on an older engine refuses the package. The site then keeps what it had. Choose the version that you tested with in the dev kit. That is in engine/VERSION.
Using it
- You choose a package per site and per environment, under Theme → Theme version of the site.
site.theme.packageis then{key, version, sha256, bytes, engine, parent}.parentcomes from itsTHEME. When it is missing, it isbase. The signal carriestheme.GET /delivery/v1/theme/<key>/<version>gives the zip, withX-Theme-SHA256. Switch only when the hash matches.- The own themes of an agency run only on a frontend that the agency owns.
New engine versions
The platform moves every frontend to the newest engine at once. Semver is the rule:
- A patch or a minor, such as 1.4.0 → 1.5.0, goes everywhere that the
engineof your theme allows it. - A new major, such as 2.0.0, goes only where the rule names that major, such as
^2.0.0or>=2.0.0.>=1.118.0alone does not allow 2.x. - An environment whose theme does not allow the new version stays on what it runs. You see it under Organisation → Themes. Your managers get one mail per major.
- Once your theme works on the new version, change
enginein itsTHEME, and upload it. The next upgrade then moves it. - After a term, a held environment moves anyway. The platform sets that term, per agency.
Also called: theme deployment, template package, CI/CD, design system, engine upgrade.
Last changed