Propel
Blade-inspired templating for Rocket.rs.
What Propel is
Propel is a templating system for Rocket, the Rust web framework. You write views in the syntax of Laravel's Blade: @if, @foreach, layouts with @extends, and escaped output by default. Views live in .propel files next to the rest of your Rocket app.
Each view is compiled into Rust when the app builds, in development and in release. A template that uses a field its context does not have fails to build, and the error names the template file and line.
What it brings to Rust
- Familiar syntax. Web developers who know Blade can write Rocket views without learning a new template language.
- Safe by default.
{{ }}escapes HTML. Raw output needs an explicit raw-output tag, and echoed URLs with unsafe schemes are replaced. - Vite and Tailwind built in.
asset()and@viteconnect a Rocket app to Vite and Tailwind, with hot reload in development and hashed files in production. - Debugging helpers.
@dumpand@ddprint a value while you develop. - Typed contexts. Each view has a Rust struct, and the handler fills it. Each template is checked against it when the app builds.
Inspiration
- Laravel Blade for the syntax and the layout model.
- Laravel's Vite plugin for the manifest and hot-file conventions.
- Sage, the WordPress theme built on Laravel's tools, for the asset layout and the
@imagesand@fontsaliases. - Rocket, the framework Propel is built for: its routing, responders and focus on speed.
Other Rust template engines
Askama compiles templates to Rust, and Tera renders them at runtime with Jinja-style syntax. Propel aims for Blade's syntax, Rocket's integration, and the asset workflow Laravel developers already use.
References
Propel is a Blade-inspired templating engine for Rocket.rs. These are the sources it draws on.
- Rocket, the web framework
- Laravel Blade, the syntax Propel follows
- Laravel Vite, the asset conventions
- Sage, the asset layout and aliases
- Vite and Tailwind CSS, the build tools
- Astro docs, the look of this site
- The Propel repository, with the design plan and the decisions behind it
Propel