Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: replace sailfish with tera #341

Merged
merged 2 commits into from
Oct 14, 2023
Merged

Conversation

da2ce7
Copy link
Contributor

@da2ce7 da2ce7 commented Oct 14, 2023

No description provided.

@da2ce7 da2ce7 temporarily deployed to coverage October 14, 2023 20:12 — with GitHub Actions Inactive
@da2ce7 da2ce7 temporarily deployed to coverage October 14, 2023 20:19 — with GitHub Actions Inactive
@codecov-commenter
Copy link

codecov-commenter commented Oct 14, 2023

Codecov Report

Merging #341 (b0f2913) into develop (0491148) will increase coverage by 0.45%.
The diff coverage is 78.37%.

@@             Coverage Diff             @@
##           develop     #341      +/-   ##
===========================================
+ Coverage    43.92%   44.37%   +0.45%     
===========================================
  Files           77       77              
  Lines         4442     4473      +31     
===========================================
+ Hits          1951     1985      +34     
+ Misses        2491     2488       -3     
Files Coverage Δ
src/mailer.rs 41.25% <78.37%> (+34.23%) ⬆️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@da2ce7 da2ce7 temporarily deployed to coverage October 14, 2023 20:28 — with GitHub Actions Inactive
@da2ce7
Copy link
Contributor Author

da2ce7 commented Oct 14, 2023

ACK b0f2913

@da2ce7 da2ce7 merged commit aec16e6 into torrust:develop Oct 14, 2023
8 checks passed
@josecelano
Copy link
Member

Why?

Both Sailfish and Tera are template engines for Rust. Let's look at their characteristics:

Sailfish:

  1. Performance: Sailfish claims to be extremely fast and is optimized for performance.
  2. Syntax: It has its own template syntax which can be more concise in some scenarios.
  3. Tooling: Offers some tooling like code completion and syntax highlighting for various editors.
  4. Flexibility: As with many template engines, you can extend and customize the behavior to suit your needs.

Tera:

  1. Jinja2-inspired: Tera's syntax and behavior are largely inspired by the Jinja2 template engine (commonly used with Python).
  2. Filters: It supports filters which can be used to modify variables inside templates.
  3. Inheritance and Macros: Tera supports template inheritance and macros, which can be powerful for creating reusable components and layouts.
  4. Safety: Tera ensures that the templates do not have access to the functions and methods of the variables passed to it, promoting safer templates.

Why might you choose Tera over Sailfish or vice versa?

  1. Familiarity with Jinja2: If you're familiar with Jinja2 (or Django templates), Tera might feel more intuitive.
  2. Project Requirements: If you need features like filters or macros, Tera could be more appealing.
  3. Performance: If raw speed is a crucial metric for your project, you might benchmark both engines with your use-case to see which one performs better.
  4. Syntax Preference: This can be subjective. Some developers might prefer the concise syntax of Sailfish, while others might prefer Tera's Jinja2-inspired syntax.

In the end, the choice between the two largely depends on your personal or project-specific needs and preferences. If you're unsure, it might be helpful to create a small prototype using both engines to see which one you prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants