# variants/ — client variant tooling This folder holds the GENERIC, public tooling for building thin client variants of this theme (see the main `README.md`, section "Client variants (house styles) without code duplication" for the full concepts). Only the confidential parts are gitignored and stay in the private variants repo: `variants/*.json` (client definitions), `variants/leak-patterns.txt`, `variants/tests/`. ## Files - `build.php` — build ONE variant: `php variants/build.php `. Generates `..//config.xml` from the mother `config.xml` + the client json (see the header comment of `build.php` for all rules: unknown option keys fail loudly, `files/preview.svg` is added only at first creation and never overwritten, warning when preview.png equals the mother's, NEW mother option keys are auto-added to the json as `""` with a `_formats` hint). - `build_all.sh` — build/rebuild ALL variants in one go: `bash variants/build_all.sh ` builds only jsons with NO variant folder yet; `bash variants/build_all.sh --rebuild ` rebuilds only existing ones; skipped jsons are listed at the end. - `export_options.php` — generate a client json from the CURRENTLY SAVED theme options in the LimeSurvey UI (global or per survey): `php variants/export_options.php --global|--sid [--title ...] [--definitions-dir ...] [--force]`. - `document_options.php` — refresh the `_formats` hints in every json after a mother config.xml change: `php variants/document_options.php [--check]`. - `option_formats.php` — shared helper (option key → value-format hint), used by `build.php` and `document_options.php`. - `export_public.sh` — build the checked public zip (leak check + external-host check + stale-css check); aborts on any violation. - `example/` — public example output of a variant build (`respondage_respondage`). ## The variant definition json (`.json`) Reference structure (all 109 option keys of the mother config.xml are listed, so it is visible what CAN be set per variant): ```json { "name": "respondage_client", "title": "Client LimeSurvey theme", "description": "Client theme, based on Vanilla Respondage
Thin variant of vanilla_respondage: only the house-style option values (colors, fonts, font sizes/weights/colors, logo files) differ. All views, CSS and JS are inherited from the mother theme.", "_note": "All option keys of the mother config.xml are listed. An empty value (\"\") means: inherit the default from vanilla_respondage (build.php skips empty values). Keys marked HOUSE-STYLE in config.xml are the per-client house-style values; the rest are structural and normally left empty.", "options": { "font": "my_custom_font", "fontsize": "18px", "primarycolor": "#123456", "navbarfontcolor": "other", "navbarfontcolorcustom": "#123456", "brandlogofile": "./files/client-logo.png", "...": "" }, "_formats": { "font": "font value slug, e.g. \"inter\"", "primarycolor": "hex color, e.g. #123456", "navbarfontcolor": "chooser mode: one of default|defaultbackgroundcolor|color1|color2|color3|other — when 'other', put the hex in navbarfontcolorcustom", "...": "" }, "files_add": { "css": ["css/variant.css"], "js": [] }, "fontOptions": [ { "value": "my_custom_font", "label": "My Custom Font" } ] } ``` - `name` must equal the file name and the generated folder (`respondage_`). - `options`: an **empty value (`""`) means "inherit the mother default"** and is skipped by the build. Fill in the house-style values you know; leave the rest empty. Legacy keys (e.g. `logotopmargin`, `logo`, raw hex in a chooser option, `400|700` font weights) are still accepted and migrated by `build.php`. Value formats per key are documented in `_formats` (regenerate with `document_options.php`). - `_formats`: documentation only — never read by the build or the drift check. - `files_add`: extra files the variant ships (appended to the `` list). - `fontOptions`: custom fonts appended to the "Custom (this theme)" optgroup; the font files + `@font-face` + generic `.font-` rule live in the `/` asset folder (`files/fonts/`, `css/variant.css`). - The whole `//` asset folder (logos, fonts, css, `files/preview.svg`) is copied into the generated theme by `build.php`. ## Workflow 1. Create/edit `.json` + `/` assets (or generate the json from saved UI options with `export_options.php`). 2. Build: `php variants/build.php ` (or `bash variants/build_all.sh ...` for all). 3. Deploy `..//` to `upload/themes/survey/` and reset the theme in the LimeSurvey admin (Theme options → Reset), then `flushassets` + Ctrl+F5. 4. Rebuild after every json/config.xml change (`build_all.sh --rebuild`); a stale variant folder does not match its definitions.