- README.md: restructure Preview section into Static + Dev modes with feature comparison table; mention juice inlining and live reload - CONTRIBUTING.md: update Development Setup with Go/Node.js requirements, static vs dev preview workflows, Juice reference - AGENTS.md: add dev command to subcommand list, document tools/server/ directory, update Build Tool section - docs/CONTRIBUTING.*.md (5 languages): add dev server section, Node.js requirement, live reload description - docs/README.*.md (5 languages): add dev mode to Preview section - docs/images/README.md: update capture instructions for dev server Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4.2 KiB
4.2 KiB
AGENTS.md — Gitea Mail Templates
Project Overview
A curated collection of email template themes (10 visual styles) for self-hosted Gitea instances. Each theme contains 11 Go html/template files covering all Gitea notification email types.
Repository Layout
themes/ # Template themes (10 styles, 11 .tmpl each = 110 source files)
aurora/ # Ethereal / Dreamlike
bloom/ # Creative / Startup (glassmorphism)
ember/ # Community / Open Source
heritage/ # Education / Research
horizon/ # Enterprise / Corporate
ink/ # Editorial / Publishing
mono/ # Minimal / Swiss design
neon/ # Cyberpunk / Gaming
terminal/ # Developers / Tech
terra/ # Nature / Sustainability
tools/ # Go CLI tooling (modular, zero dependencies)
tools.go # Main entry point
cli/ # CLI subcommands: list, create, delete, preview
config/ # Config types and templates_config.json loading
data/ # templates_config.json — single source of truth for template metadata
preview/ # Template rendering engine (funcs, locale, engine)
go.mod # Go module (stdlib only, zero dependencies)
preview/ # Browser-based live preview
index.html # SPA with style/template/client/viewport switching
rendered.js # Pre-rendered HTML (generated, committed for clone-and-preview)
docs/ # Multi-language documentation
Working With Templates
Template Files
- All
.tmplfiles use Gohtml/templatesyntax - Must use only Gitea's built-in template functions:
AppUrl,DotEscape,QueryEscape,ShortSha,HTMLFormat,PathEscapeSegments,FileSize - Must use only official Gitea translation keys (
mail.*namespace) - Never reference
.DisplayNamein templates where the data context lacks it (collaborator, transfer, release, workflow_run, assigned, default) - Each style must have all 11 template types
Adding a New Theme
- Scaffold the new theme:
cd tools && go run . create <name>— creates the full directory structure with placeholder.tmplfiles for all 11 email types - Write all 11
.tmplfiles with unique visual design - Run
cd tools && go run . preview allto regenerate preview data - Update README.md style gallery table
Preview System
preview/index.htmlloadspreview/rendered.js(pre-rendered by Go) and displays in iframes- Supports theme/template switching, client simulation (Modern/Gmail/Outlook/Raw), and viewport toggle (Desktop 1386x780 / Mobile 390x780)
REGISTRYandPARAMSare auto-generated fromtemplates_config.json— no manual syncing needed- Static preview (open
index.htmldirectly) provides approximate client simulation - Dev server (
go run . dev) provides accurate rendering via Juice CSS inlining + live reload
Build Tool
tools/tools.gois the main entry point for the modular CLI- Subcommands:
list,create,delete,preview,dev - Template metadata lives in
tools/data/templates_config.json— the single source of truth tools/config/handles config loading and data flatteningtools/preview/implements the rendering engine (template funcs, locale, engine, markSafeHTML)tools/cli/implements CLI subcommands usinggithub.com/urfave/cli/v2tools/server/Node.js dev server with Juice CSS inlining and live reload (Express + WebSocket + fs.watch)- Uses Go's native
html/templatepackage for template rendering
Commit Conventions
style(name):— template changes for a specific themepreview:— preview tooling changestools:— Go CLI/build tooling changesdocs:— documentation and translationsfix:— bug fixesproject:— README, LICENSE, AGENTS.md, metarefactor:— code restructuring (e.g. modularization)chore:— maintenance (config updates, build scripts)
Constraints
- No JavaScript framework dependencies — preview is vanilla JS
- No external Go dependencies — build uses stdlib only
- Templates must remain compatible with Gitea's
html/templateexecution environment - Preview works with
file://protocol (no server needed)