#Templating engine (Askama, Tera)

17 messages · Page 1 of 1 (latest)

storm heron
#

Hey everyone, I'm new to tauri (and kind of new to rust), have tried to search for it but no luck. Can we use a jinja like templanting with tauri? If yes, how that would work, since by default tauri just loads index.html file, no idea how I could make it to render the templates.

Thanks!

acoustic lantern
#

have you looked into trunk ?

storm heron
#

No, not really, but it looks like replacement for tauri?

I'm coming from python world and have a desktop up built with FastAPI with jinja2 templates and HTMX, since python is a deployment nightmare I'm searching for better alternatives, played with tauri for past few days, managed to implement htmx and everything works like a charm. Last missing puzzle is porting those templates, not a deal breaker, but would be awesome to have it :).

acoustic lantern
#

tauri itself have static file server (kind of), you can use something to compile anything to html/js/css and save it in dist folder. then tauri will serve that to frontend web-view.

storm heron
#

So it's possible to re-build the templates on each reload and serve them updated?

acoustic lantern
#

yes, you have to create some kind of server within tauri or as sidecar

storm heron
#

I see, since rust is not my native lang probably re-designing frontend will be easier ^^

acoustic lantern
#

tauri is like cdn servers and it serve frontend to os web-view on custom protocol for safety. you have then multiple options to play in frontend and backend.

#

No, not really, but it looks like replacement for tauri?

no, trunk is like vite. it compiles rust code for frontend with other stuff. it is used for development server and compile time only.

storm heron
#

Got it, one way could be using axum + templating and serve it with tauri, but it's all new for me and at first I'm trying to minimalize friction

acoustic lantern
#

will your app get data from your servers ?if yes > then question do you need any code on user device that needs to be not js

#

you can do most stuff without doing much in rust as long as you are just creating single page app that can run in browser

#

and if you still need some action or few things needed done privatly use tauri commands or events

storm heron
acoustic lantern