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 Techlo is that src/config/config.toml is not read directly everywhere.

Instead, Techlo converts it into a generated JSON file:

  • source: src/config/config.toml
  • generated output: .astro/config.generated.json

In the Tina edition, Site settings at /admin/ edits config.toml. In the Sanity edition, Site settings in the Studio wins over the same value in config.toml, and the file holds the defaults and the few settings that stay in code.

Why This Exists

A lot of Techlo 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 in dev mode

Relevant script commands from package.json in the Astro edition:

"dev": "node scripts/dev.mjs",
"build": "npm run toml:watch && astro build && npm run remove-draft-from-sitemap",
"toml:watch": "node scripts/toml-watcher.mjs"

The Sanity edition has the same three lines. In the Tina edition, dev and build go through one script that also runs the editor:

"dev": "node scripts/tina/run.mjs dev",
"build": "node scripts/tina/run.mjs build",
"toml:watch": "node scripts/toml-watcher.mjs"

What This Means In Practice

In development

npm run dev generates the JSON from config.toml, watches the file for changes, and starts the site, so changes to config.toml regenerate the JSON automatically. When you stop npm run dev, the watcher stops too.

In production build

npm run build regenerates the JSON first, then runs Astro build.

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 or editor replacement behavior got interrupted

Some settings always need a restart, such as trailingSlash and everything under [settings.multilingual].

Rule Of Thumb

  • Edit src/config/config.toml
  • Never manually edit .astro/config.generated.json

The generated JSON is an output artifact, not the source of truth.

Type something to search...