Zendesk theme source for the External help centre, built from the upstream Copenhagen theme plus per-centre overrides. The structure supports several help centres sharing a common base, should another be added.
copenhagen_theme— a submodule reference to the upstreamshared— changes that are applied to all help centre themesexternal— changes that are only applied external
Additional help centres are added as a sibling folder of external, then listed in releases in scripts/build.mjs.
shared and each centre folder can modify the base theme in the following ways:
build.include— specifies the files to copy or ignore from the base themeadditions/— matches the same paths as the base theme, any content will be attached to the end of the matching fileadditions/translations/*.jsonare handled in a special way for convenience, any items will be attached to the original theme translation JSON file.original->shared-><folder>. You can not currently replace existing keys in the original, only add new ones. You can overwrite keys added insharedinside<folder>but there will be a warning
replacements/— matches the same paths as the base theme, any content will fully replace the matching file*.patch.json— a simple method to adjust JSON in place based on RFC 6902 JSON Patches- mostly focused on adjusting
manifest.json - to build these out:
- copy the
.jsonfile you're targeting- you may need to template out
copenhagen_theme/<target>.jsonwithshared/<target>.patch.jsonbefore making your adjustments./scripts/apply-json-patch.mjs copenhagen_theme/<target>.json <folder>/<target>.patch.json > <modified_target>.json- or copy out of the
<folder>/builddir but if the<folder>is a centre, it could also be affected byshared, the modifications should be centre specific.
- you may need to template out
- make your adjustments
- run
./scripts/gen-json-patch.mjs copenhagen_theme/<target>.json <modified_target>.json > <folder>/<target>.patch.json - make sure you clean up
<modified_target>.jsonand don't commit it
- copy the
- mostly focused on adjusting
*.patch— standard unified diff/git diff style patches to make more targeted adjustments to source code- applied with
git apply, so they behave exactly as they do on the command line. Generate them withgit diff/git format-patch, ordiff -u --label a/<path> --label b/<path> - paths are relative to the theme root and need the
a/b/prefixesgit diffemits - hunks must carry context lines, and a hunk starting at line 1 is pinned to the top of the file — if upstream changes the first line, regenerate the patch
- a chunk whose target file isn't in the build is skipped, so a
sharedpatch can touch a file a centre leaves out of itsbuild.include; anything else that fails to apply fails the build - name in the format
NNNN-simple-explanation.patchto help understand what the file does- detailed rules:
- for numbering
sharedpatches they should typically prefix0000incrementing up by 1 - in the very unlikely event a patch needs to apply after a centre specific patch it should be prefixed
2000incrementing up by 1 - for numbering centre specific patches they should typically prefix
3000incrementing up by 1 - in the very unlikely event a centre specific patch needs to apply before a
sharedpatch it should be prefixed1000incrementing up by 1
- for numbering
- TL;DR
shared/0001-some-shared-change.patchshared/2001-some-shared-change-after-centres.patch- it's not completely after but is after the1000range centres can useshared/1001-some-pre-centre-change.patch- it's not completely before but is before the3000rangesharedcan useexternal/3001-some-external-centre-change.patch
- detailed rules:
- applied with
Ensure you have the submodules by running git submodule update --init --recursive
Run ./scripts/build.mjs after making modifications according to the guidance above, ready for zcli themes:preview / zcli themes:import.
Build output lands in <centre>/build — currently just external/build — which is not committed.
The build tooling has its own tests: cd scripts && npm install && npm test.
Change into the copenhagen_theme submodule directory, fetch changes from remote, then switch to the new tag.
Apache License 2.0 — see LICENSE.