Generated Config From TOML
One of the biggest beginner pain points in Techbyte is that src/config/config.toml is not read directly everywhere.
Instead, Techbyte converts it into a generated JSON file:
- source:
src/config/config.toml - generated output:
.astro/config.generated.json
Why This Exists
A lot of Techbyte code imports config like this:
import config from ".astro/config.generated.json";This makes the config easy to consume from Astro components, utilities, and scripts without reparsing TOML everywhere.
How It Gets Generated
The build helper is:
scripts/toml-watcher.mjs
It:
- reads
src/config/config.toml - parses it with
toml - writes
.astro/config.generated.json - watches the TOML file when
npm run devruns
In the Sanity edition, it also adds your project’s Site settings, which win over the same value in config.toml.
To generate the file once, run:
npm run toml:watchWhat This Means In Practice
In development
npm run dev generates the settings file from config.toml, watches it for changes, and starts the site, so changes to config.toml regenerate the JSON automatically. All three editions do this. In the Tina edition, it starts the editor too.
A few settings need a restart: trailingSlash under [site], and everything under [settings.multilingual].
In production build
npm run build regenerates the JSON first, then runs the Astro build, followed by the sitemap cleanup and critical CSS inlining steps.
Common Confusion
If you edit config.toml but don’t see the expected change:
- make sure you started the project with
npm run dev - check that
.astro/config.generated.jsonwas regenerated - restart dev if the watcher got interrupted
Rule Of Thumb
- Edit
src/config/config.toml(Site settings in the Tina and Sanity editions) - Never manually edit
.astro/config.generated.json
The generated JSON is an output artifact, not the source of truth.