Pug Compilation Architecture: Compile Once, Render Fast with Safe Data Boundaries
Pug turns templates into cached JavaScript functions. This architecture note covers the minimal render design, escaping trust boundaries, cache operations, failure modes, and when to add file watchers for dynamic templates.