Templating
The templating system is the core system that processes and transforms your template files during archetype generation. It provides powerful templating capabilities using Jinja2-compatible syntax, enabling you to create dynamic, flexible, and maintainable templates for your archetypes.
Overview
The templating system processes all files in your archetype's template directories, replacing variables, executing template logic, and generating the final project structure. It supports everything from simple variable substitution to complex conditional logic and template inheritance.
Key Features
- Jinja2-Compatible Syntax: Familiar templating syntax with variables, conditionals, loops, and filters
- Dynamic File Names: Use template syntax in file and directory names
- Template Inheritance: Create reusable base templates that can be extended
- Conditional Rendering: Include or exclude content based on user inputs
- Advanced Filters: Built-in case conversion and formatting filters
- Performance Optimized: Efficient template compilation and rendering
Templating Components
Fundamentals
Learn the basics of template development, including file organization, processing rules, and core syntax patterns.
Organization
Discover effective patterns for organizing your templates, from hierarchical structures to feature-based organization and shared components.
Advanced Techniques
Master advanced templating features including template inheritance, dynamic template selection, and working with complex data structures.
Testing & Validation
Ensure your templates are robust with comprehensive testing strategies, validation techniques, and debugging approaches.
Performance
Optimize your templates for better performance with compilation strategies, efficient conditional rendering, and best practices.
Getting Started
If you're new to templating, start with the Fundamentals section to learn the core concepts and syntax. For experienced users looking to improve their template organization, jump to Organization or explore Advanced Techniques for powerful templating patterns.
Template Processing Flow
- Discovery: Templating system scans template directories
- Variable Resolution: Resolves variables from user inputs and scripts
- Template Compilation: Compiles templates for efficient processing
- Rendering: Processes templates and generates output files
- Post-Processing: Applies any final transformations or validations
The templating system works seamlessly with the Scripting to provide a complete archetype development experience.