Skip to content
New: Customize your theme with an AI assistant. Read the guide

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:

  1. reads src/config/config.toml
  2. parses it with toml
  3. writes .astro/config.generated.json
  4. watches the TOML file when npm run dev runs

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:

Terminal window
npm run toml:watch

What 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:

  1. make sure you started the project with npm run dev
  2. check that .astro/config.generated.json was regenerated
  3. 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.

Type something to search...