diff --git a/AGENTS.md b/AGENTS.md index 5dd2530..9ba6bc0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -48,12 +48,11 @@ docs/ # Multi-language documentation ### Preview System - `preview/index.html` loads `preview/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) -- Keyboard navigation: `←→` cycles focus between Theme/Template/Client selects, `↑↓` selects within the focused dropdown, `d`/`m` toggles viewport +- Supports theme/template switching, view mode (Modern/Source), and viewport toggle (Desktop 1386x780 / Mobile 390x780) +- Keyboard navigation: `←→` cycles focus between Theme/Template/View selects, `↑↓` selects within the focused dropdown, `d`/`m` toggles viewport - `REGISTRY` and `PARAMS` are auto-generated from `templates_config.json` — no manual syncing needed -- Static preview (open `index.html` directly) — all client modes show the same HTML; simulation warning is displayed -- Dev server (`go run . dev`) — applies Juice CSS inlining server-side, generates three `rendered.js` variants (modern/gmail/outlook) with client-specific CSS stripping; includes live reload via WebSocket -- Dev mode shows an info notice: simulation cannot 100% reproduce every email client — always verify against real clients +- Static preview (open `index.html` directly) — works via `file://` protocol with Modern and Source views +- Dev server (`go run . dev`) — pure Go HTTP server with SSE live reload; watches `themes/` for `.tmpl` changes, re-renders in-process, and pushes reload events to the browser ### Build Tool - `tools/tools.go` is the main entry point for the modular CLI @@ -62,7 +61,7 @@ docs/ # Multi-language documentation - `tools/config/` handles config loading and data flattening - `tools/preview/` implements the rendering engine (template funcs, locale, engine, markSafeHTML) - `tools/cli/` implements CLI subcommands using `github.com/urfave/cli/v2` -- `tools/server/` Node.js dev server with Juice CSS inlining and live reload (Express + WebSocket + fs.watch) +- `tools/preview/server.go` pure Go dev server with SSE live reload and in-process template re-rendering - Uses Go's native `html/template` package for template rendering ## Commit Conventions diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5e2a3a2..d6be3ce 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,7 +20,7 @@ Thanks for your interest in contributing! This project aims to provide a diverse - Translation keys must come from Gitea's official locale files (`mail.*` namespace) - **Never reference `.DisplayName`** in templates where the data context lacks it (collaborator, transfer, release, workflow_run, assigned, default) - Design for 600px max-width email clients -- Test against major email clients (Gmail, Outlook, Apple Mail) when possible +- Test against major email clients (Apple Mail, Gmail, Outlook) when possible ### Bug Reports @@ -41,18 +41,14 @@ Documentation updates, preview screenshots, installation guides, and translation ## Development Setup - **Go 1.21+** for template rendering and the CLI tool -- **Node.js 18+** (optional) for the live-reload dev server with Juice CSS inlining ### Previewing Locally (Static) 1. Run `cd tools && go run . preview all` to generate rendered data 2. Open `preview/index.html` directly in a browser — no server needed -3. Use the theme switcher, template selector, and client mode toggles +3. Use the theme switcher, template selector, and view mode toggles -> [!WARNING] -> Static Gmail/Outlook simulation is approximate. Use dev mode for relatively accurate rendering. - -### Dev Server (Live Reload + CSS Inlining + Client Simulation) +### Dev Server (Live Reload) ```bash cd tools && go run . dev @@ -60,13 +56,9 @@ cd tools && go run . dev ``` - Watches `themes/**/*.tmpl` — auto-rebuilds on save -- Runs [Juice](https://github.com/Automattic/juice) to inline `
'+e+'