(Experimental) Reparse - A Flexible HTML Only Templating Engine that Compiles to Swift

Hi, everyone.

I just published a new HTML only templating engine that compiles the templates into a single swift file: Reparse

Because it is HTML only, it only uses valid HTML syntax for its control flow, and you do not need to change your HTML centric tools.

It is pretty flexible. Mixing and matching nested includes and slot declarations? No problem!

Conditionally updating attributes on a tag? Easy!

Or how about appending to a slot declared in a parent template? Possible!

The runtime performance of the compiled code is pretty good too as it is compiled into simple Swift code.

And in case of issues, you can always open the generated code and step through it with a debugger.

Here is an example of the syntax:

<r-require name="names" type="[String]" label="superheroes" />
<r-extend name="base" />
<r-extend name="body" />

        <r-include name="components.world" r-if="!(names ?? []).isEmpty">
            Ultra Heroes!
        <r-block r-else> World?</r-block>
        <li r-for-every="names">
                Hi, <r-item />. Pos: <r-index /> or +1 =
                <r-eval line="index+1" />
        <li r-else>No more heroes...</li>

    <p><r-value of="req.url.string" /></p>
<title r-add-to-slot="head">Hero List</title>

And here is how you would call it from your controller (the value parameter is required in the body template):

Pages.Index.render(req: req, superheroes: [], value: true)) // Returns a String

As it is the very first version, it is not a big deal to adjust syntax or add new features based on the feedback.

I would like if someone could contribute a command plugin and a Vapor specific build plugin for this project.

As for me: I will be attempting to migrate my existing leaf templates to Reparse templates and seeing how well it goes.

Thank you all and have a great day!

UPD: I have added a Command Plugin.