Repository navigation
Best Practices
Rules that have proven themselves in SRL projects. The details are on the linked pages.
-
Never edit generated files.
.srl/,srl/,.srl/imports/*.scssandlivingdocs.config.jsonare regenerated bysrl prepare, the Vite plugin andsrl build. Change the sources: component folders,ld-conf.json,properties.json,srl.config.json,src/assets/scss/**. See Project Structure#generated-files. -
Design tokens live in
srl.config.json, not as literal values in SCSS. Usesrl.typography-<name>(),srl.colors-<name>(),srl.spacer-get(<n>),srl.system-size-unit(<n>)(unitless numbers only) andmap.get(srl.$meta, …). Change an existing text style in the config instead of overriding it in SCSS. See Design Tokens. -
Keep names identical: folder name without prefix =
ld-conf.jsonname=<name>.html= BEM blocksrl-<name>. Number prefixes only define the order. See Components#naming-and-order. -
One SCSS file per target in
<component>/scss/.general.scssdoes not reach XBRL;xbrl.scssmust@use 'general';. Shared web/editor styles go intoweb.scss. See Components#scss-per-target. -
Branch with
srl.$system-build(app,editor,pdf,word,xbrl) when onegeneral.scssneeds target-specific rules. -
Never write
var(--srl-…)by hand in code that also compiles for Word. Use the token functions orsrl.system-root-style(). -
Treat the build output as the source of truth.
srl buildexits with 0 even on errors. Scan the log and check that the files in.output/are new. See Build#check-the-result. -
Raise the design version only when
livingdocs.config.jsonchanges in content. Revert pure reorders of that file; commit real changes together with the component change that caused them. See Build#design-version. -
Nothing but folders directly in
livingdocs/. The group mapper deletes plain files there. -
Restart the dev server or run
npx srl mapafter changingld-conf.jsonor component HTML, after adding component folders or target SCSS files, and aftersrl remove. See Getting Started#develop. -
Check for updates yourself with
npm outdated @simple-reporting/base; the dev server's update notice misses minor and major versions. -
Build the affected targets after every SCSS or config change.
npm run build-pdfis fast; build all targets for token changes.
Example: Multi-Channel Accordion walks through the accordion component: editor-only wrappers, a minimal web skeleton for the Vue component and plain content in PDF, Word and XHTML, all controlled with data-remove-from-<target>.
Remove a token or component only after you have checked every access path. Search livingdocs/, src/, the PDF scripts and the library's own SCSS and components.
A text style <name> can be used through:
| Path | Pattern |
|---|---|
| Mixin | srl.typography-<name>( |
| Getter functions |
srl.typography-get-font-size('<name>') etc. |
| CSS variables |
var(--srl-typo-<name>-…) in SCSS, Vue, TS or inline styles |
| Utility class |
.srl-typo-<name> in HTML templates, properties.json options, Vue, exported content |
| SCSS map |
map.get(…$typography…, '<name>') or loops over the map |
| Runtime config |
useSrlConfig() (the whole srl.config.json is embedded into the app bundle) |
Colors follow the same pattern (srl.colors-<name>(), srl.colors-get('<name>'), --srl-color-<name>, .srl-color-<name>, .srl-bg-<name>), spacers too (srl.spacer-get(<n>), --srl-spacer-<n>, keys in spacer.margins.group).
For components, also search global SCSS (src/assets/scss/*.scss), PDF @page rules (element(…) names), spacer.margins.group and scripts for their classes.
Then verify with the built output:
- Build all targets before and after the change.
- Diff the CSS as selector/declaration pairs. Minifiers regroup selectors and app assets have hashed names, so a plain text diff does not help.
- Only the rules of the removed token may disappear.
In built CSS, a var(--srl-typo-<name>-…) that appears only inside .srl-typo-<name> is the generated utility class, not a real usage.