Site configuration and design tokens
Site configuration gives Builder one shared place for behavior that affects every published page. It connects site identity, domains, fonts, colors, CSS values, and global page code so the editor and the live site use the same design rules.
Site-wide configuration
Builder Settings is the single site record for defaults that apply across pages. The settings screen loads this record and the project folder before it shows the available settings, while page rendering uses the saved values when it builds a live page or preview. See website rendering and publishing for the page lifecycle.
The settings surface separates site-wide choices from current-page choices. It starts from the requested tab, the last tab used by the editor, or the default for the active scope. It can restrict the view to global settings without changing the remembered page-level tab, and it restores the route's page as the active editor context when the settings view is activated.
References: frontend/…/BuilderSettings.vue• L42-120
General site settings
General settings establish the site's entry point and browser-facing identity. A selected homepage points visitors to a Builder page route, a default language supplies the HTML language when a page has no local value, and a favicon supplies the browser tab icon when a page has no local icon.
The same settings also control two broad rendering choices. Builder can convert uploaded page images to WebP, and it can disable the automatic light and dark color behavior for the whole site. A change to the dark-mode setting clears page caches because it can change the appearance of every page.
Builder Settings also holds the site-wide connection settings and default model for Builder's AI assistant. A hidden site flag records whether the persona survey has been shown; it is not a page design setting.
References: builder/…/builder_settings.json• L64-89 builder/…/builder_settings.json• L123-145 frontend/…/GlobalGeneral.vue• L1-82 builder/…/builder_page.py• L449-471
Global page code
Global page code adds site-level behavior around each rendered page. Head HTML is appended to the end of the document head for metadata, styles, or scripts; body HTML is appended to the body for scripts; global JavaScript runs on all pages; and global CSS applies to all pages.
Builder stores the global JavaScript and CSS as public assets. This keeps the page output linked to the current site-wide files instead of embedding the full code in each page. Clearing either field removes its generated public asset.
References: frontend/…/GlobalCode.vue• L1-38 builder/…/builder_settings.py• L37-75 builder/…/builder_page.py• L556-579
Editor safety settings
Developer settings control how block client scripts behave while an engineer edits a page. The editor can avoid running these scripts, run them with restrictions, or run them without those restrictions; a separate setting can stop the editor from emulating click events.
These controls affect the editing environment. They do not replace the need to treat page scripts as untrusted code, because the editor runs them in a sandbox that may not match live-site behavior.
References: builder/…/builder_settings.json• L104-120 frontend/…/GlobalDeveloper.vue• L1-36
Custom domains
Custom domains connect a Builder site to a hostname that visitors can use. The domain flow verifies DNS before it asks the hosting service to add the domain, then tracks provisioning until the domain is active.
The domain settings show the server address and the DNS record choices for the entered hostname. A root domain uses an A record. A subdomain can use a CNAME that points to the current site hostname. After activation, an engineer can select one domain as primary, redirect other active domains to it, retry a broken setup, or remove a non-primary domain.
flowchart LR
A[Enter domain] --> B[Check DNS]
B -->|Verified| C[Add domain]
B -->|Not verified| D[Fix DNS and retry]
C --> E[Provision domain]
E --> F[Active domain]
F --> G[Set primary or redirect]
The domain controls are available for Frappe Cloud sites and developer-mode sites. The server delegates domain actions to the hosting provider, so provider errors and DNS mismatches appear as domain status or setup errors rather than as page content errors. See Builder server and domain for the wider hosting boundary.
References: frontend/…/GlobalDomains.vue• L1-83 frontend/…/GlobalDomains.vue• L94-173 frontend/…/domains.ts• L14-114 builder/domain.py• L7-86 frontend/…/index.ts• L117-124
Shared design system
Builder represents reusable visual choices as design tokens and shared font records. The editor can resolve these choices while a user edits a block, and the renderer exposes the same values to the published page as CSS custom properties and font faces.
Design tokens
A Builder Token is a named design value that blocks can reuse. Its record has a human label, a group, a type, a light value, and an optional dark value; the supported types are Color, Dimension, and Font. The token's document ID is the CSS handle, so a block uses var(--<document-id>) rather than the human label.
The token manager reads up to the site's token list and lets the editor create, update, or delete records. It resolves a token to its light value by default and to its dark value when one exists. If no dark value exists, the light value remains the fallback.
References: builder/…/builder_token.py• L17-58 builder/…/builder_token.py• L68-81 builder/…/builder_token.json• L14-55 frontend/…/builderToken.ts• L1-12 frontend/…/useBuilderToken.ts• L23-128
Token CSS metadata
Token values become shared CSS custom properties for the site. The tokens.css asset exposes the light values in :root and uses the dark value with CSS light-dark() when a token has a different value for dark mode; the older variables.css path remains an alias for pages that still use that name.
The server caches the token map for reuse across requests and clears both the token data cache and the rendered CSS page cache when a token changes. Preview and PDF rendering inline the same CSS because those renderers cannot rely on fetching the dynamic asset route. See website rendering and publishing for how page output consumes this shared data.
References: builder/…/builder_token.py• L84-126 builder/…/tokens.py• L1-7 builder/…/tokens.css• L1-3 builder/…/variables.py• L1-5 builder/…/builder_page.py• L454-467
User fonts
A User Font binds a unique font family name to an uploaded font file. The editor loads these self-hosted fonts when a block uses the family, so the font does not depend on a third-party font request. A user font can also be created when an imported page brings in a remote webfont.
The font picker combines the built-in Google Fonts catalog with the site's user fonts. It loads the catalog on demand, checks available weights, and previews only the visible label for remote families to keep browsing light. A font token is resolved to its family before the font loader chooses between a user font file and Google Fonts.
References: builder/…/user_font.json• L8-23 builder/…/user_font.py• L9-42 frontend/…/userFonts.ts• L1-11 frontend/…/fontManager.ts• L56-79 frontend/…/fontManager.ts• L131-159 builder/api.py• L101-157
CSS property metadata
CSS metadata gives the style editor a common view of CSS properties and their value kinds. It maps properties to controls for colors, lengths, numbers, integers, and keywords; it also supplies keyword choices and unit choices where the editor can offer them.
The metadata is used to search the baseline property set and to reject malformed property names when the editor handles a style that has no special control. This keeps the style panel consistent while still allowing valid CSS properties that are not tied to a custom control.
References: frontend/…/cssMetadata.ts• L14-45 frontend/…/cssMetadata.ts• L47-105 frontend/…/cssMetadata.ts• L134-157 frontend/…/stylePropertiesWithControls.ts• L1-44
Color values
Color utilities give the editor one normalized path for color input and display. They convert among hex, RGB or RGBA, and HSV forms, while preserving alpha as an eight-digit hex value when needed.
Color token choices use the token's resolved light or dark value for their swatch. A literal color is treated as the current value rather than as a token search, while token names and groups remain searchable. This lets a user switch between a fixed color and a shared, theme-aware color without changing the rest of the style flow.
References: frontend/…/colors.ts• L4-55 frontend/…/colors.ts• L58-137 frontend/…/colorOptions.ts• L7-50 frontend/…/colorOptions.ts• L51-87
Gradient values
Gradient utilities turn CSS linear and radial gradients into editable parts and then turn those parts back into CSS. The editable model keeps the gradient type, direction or shape, and ordered color stops with positions.
Parsing respects parentheses inside color functions, so commas in values such as RGB colors do not split the gradient into false stops. When the editor writes a gradient, it sorts stops by position and emits a consistent percentage-based form.
References: frontend/…/gradientUtils.ts• L1-63 frontend/…/gradientUtils.ts• L65-93
Configuration relationships
The site settings, token records, font records, and page renderer form one path from a shared choice to visible site output. The editor reads shared records for controls and previews, while published rendering reads the same records to build page assets and styles.
This diagram shows the main relationship between configuration records, editor behavior, and page output.
flowchart TD
S[Builder Settings] --> E[Editor and page defaults]
T[Builder Tokens] --> E
T --> C[Shared token CSS]
F[User Fonts] --> E
F --> P[Page font resources]
D[Domain service] --> H[Site hostnames]
E --> R[Preview]
C --> R
P --> R
E --> L[Published page]
C --> L
P --> L
A page can override site defaults with its own page settings, styles, or fonts. Shared values remain useful when many pages must change together, while page-local values remain useful for a deliberate exception. See Builder content documents for page data and server APIs and events for the request boundary.
Configuration paths
The main paths for shared design behavior are grouped by the responsibility they own:
| Concern | Shared source | Downstream effect |
|---|---|---|
| Site defaults | Builder Settings | Homepage, language, favicon, image handling, dark-mode behavior, global code, and Builder assistant defaults |
| Theme values | Builder Token | CSS custom properties and token-aware editor controls |
| Font files | User Font | Self-hosted font loading and font picker choices |
| CSS editing | CSS property metadata | Property search, value choices, units, and style controls |
| Hostnames | Domain service | DNS verification, domain activation, primary host, and redirects |
References: frontend/…/builderSettings.ts• L1-9 frontend/…/builderToken.ts• L1-12 frontend/…/userFonts.ts• L1-11 builder/domain.py• L40-86 builder/…/builder_page.py• L482-518
Change checklist
When these files or sections are changed, remember to consider these:
- When a token's ID or naming rules change, update every block and component reference that uses its
var(--...)handle. The human token label is not the CSS handle. - When token values or dark values change, keep the editor resolver, the tokens.css route, the preview inline CSS, and both cache invalidation paths aligned.
- When a User Font field or asset path changes, keep the font list resource, import flow, block reference lookup, and runtime font loader aligned.
- When global script or style storage changes, keep public asset generation and the page renderer's script and style links aligned.
- When domain actions change, keep the frontend status and DNS guidance aligned with the provider API method names and response states.
- When CSS metadata changes, keep property classification, editor controls, keyword lists, and style-property validation aligned.
- When settings tabs or their visibility rules change, keep the remembered tab and global-only settings view valid for every entry path.
- When Builder assistant settings change, keep the site-level settings record aligned with the assistant's provider and model selection flow.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A block uses a token label instead of its document ID | The CSS variable does not resolve, so the block falls back or shows an invalid value | Use the exact var(--<document-id>) handle from the token record |
| A token is changed without clearing its cached CSS | The editor or site can keep showing an old theme value | Clear the token data cache and both token asset page caches on change |
| DNS records do not match the domain being added | Domain verification fails or the domain stays broken | Use the shown A or CNAME target, then retry after DNS propagates |
| A user font family is renamed without updating page references | Existing blocks cannot find the uploaded font | Find referencing pages before changing or deleting the font record |
| A global CSS or JavaScript field changes without regenerating its public asset | Published pages can keep loading stale site-wide code | Save through the settings document so its public URL asset is updated |
| A site-wide setting changes without clearing rendered page cache | Published or previewed pages can keep using the old site behavior | Keep site-wide cache clearing aligned with the settings fields that affect page output |
Key files
| File | Why to read it |
|---|---|
| builder/…/builder_settings.json | Defines the site-wide settings and their defaults |
| builder/…/builder_settings.py | Shows how settings affect caches and global public assets |
| frontend/…/BuilderSettings.vue | Coordinates settings loading, tab selection, and global-only versus current-page views |
| frontend/…/GlobalGeneral.vue | Connects general site choices to the settings record |
| frontend/…/GlobalCode.vue | Shows the scope of global HTML, CSS, and JavaScript |
| frontend/…/GlobalDomains.vue | Shows the DNS, provisioning, primary-domain, and redirect flow |
| builder/domain.py | Defines the server boundary for domain operations |
| builder/…/builder_token.py | Defines the shared token-to-CSS path and cache behavior |
| builder/…/tokens.css | Shows the CSS form consumed by published pages |
| frontend/…/useBuilderToken.ts | Shows how the editor resolves token values and dark values |
| builder/…/user_font.py | Defines the shared user-font list and page references |
| frontend/…/fontManager.ts | Shows how the editor loads user and remote fonts |
| frontend/…/cssMetadata.ts | Defines the style-property model used by editor controls |
| frontend/…/colors.ts | Defines the color conversion boundary |
| frontend/…/gradientUtils.ts | Defines the editable gradient model and CSS conversion |