Template Rendering
Powerful built-in Moro template engine with zero dependencies. Also supports Handlebars and EJS with layouts, partials, and custom helpers.
Moro Template Engine (Built-in)
Zero Dependencies • Fast • Lightweight
Moro's built-in template engine requires no external packages. It provides Handlebars-like syntax with variables, loops, conditionals, partials, and layouts out of the box.
- • No external dependencies
- • Fast rendering with optional caching
- • Layouts and partials support
- • Auto-escapes HTML by default
- • Custom helpers and filters
- • Familiar Handlebars-like syntax
Quick Start - Moro Templates
typescript
Moro Template Syntax - Full Examples
typescript
Layouts with Moro Templates
typescript
Partials - Reusable Components
typescript
Custom Helpers and Filters
typescript
Complete Example - Blog Post
typescript
Alternative Template Engines
While Moro's built-in engine covers most use cases, you can also use Handlebars or EJS if needed. These require installing additional packages.
Using Handlebars
typescript
Using EJS
typescript
Best Practices
Do
- • Enable template caching in production
- • Use layouts for consistent structure
- • Create reusable partials
- • Escape user input in templates
- • Use helpers for complex logic
- • Organize templates by feature
Don't
- • Put complex logic in templates
- • Disable caching in production
- • Trust user input without escaping
- • Mix template engines
- • Create deeply nested templates
- • Skip template validation