home.social

#askama — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #askama, aggregated by home.social.

fetched live
  1. Since we're talking about responses let’s address the elephant in the room: HTML.

    In Ruby pretty much every framework support some form of templating. Even barebones Sinatra gives you ERB out of the box and pretty much any other template engine is only one line in the gemfile away.

    Axum doesn't provide any templating. You’ll have to bring your own.

    I picked #Askama as it was the first templating engine on Are We Web Yet.

    It's a dialect of Jinja. But maybe not 100% compatible. No matter.

    One thing you learn fast is that in Rust everything is a type. So your template has to have an actual template and a struct that provides data for the template. You can't just put random code in your templates. On one hand it’s great as you can't by accident have n+1 queries in your template. On the other, to change something on the page you might to edit three files: the actual template, the struct for the template, and the handler to populate the struct.

    There's no support for layouts. Well, there's kinda. Through template inheritance. It’s where you extend your layout by overriding some blocks in it. It's much more awkward than in Ruby. In Ruby layouts are conceptually separate. In Askama your template struct has to provide all the data for the template and all its parent templates. I don't even know if it's possible to render the same template in different layouts. The thing that is extremely easy in Ruby.

    There's also no support for partials. At best you can insert renders of other templates. But that's awkward for many of the same reasons (mostly around providing data for the templates).

    One major downside is that Askama uses proc macro to compile the templates to Rust. It makes it extremely fast but debugging templates is a nightmare. It gives you an error that something is missing or has a wrong type but doesn't tell you what it is or where in the template it is. Even with enabled proc macro backtraces it gives you a snippet of generated Rust code and not the template. Even the barebones ERB will give you the exact position in the template in case of an error.

    So yeah, lots of frustration.

    #Axum #Ruby #RubyOnRails #Rust

  2. yay i finished rewriting my website from #sveltekit to #Rust with #askama

    :rust: live on vavakado.xyz!!!! :cirnouwu:

    old ​version available on: old.vavakado.xyz :cirnothinking: if anyone wants to test perf or smth (don't DDOS me pls)

    #programming #webdev

  3. ✨ A wonderful tutorial on Rust+Htmx+Tailwind

    👉 Axum as Backend server
    👉 htmx for reactivity on the UI
    👉 Askama for templating
    👉 Tailwind CSS

    joeymckenzie.tech/blog/templat

    Credits: @_joeyMcKenzie

    #rustlang #htmx #askama #axum #tailwindcss #tailwind #developers #rust

  4. I developed and published it in about 6 days in my free time. For people that say that is an overkill for backends 🤨

    It is often a matter of practice to be productive in any language. Rust already offers the ecosystem.

    I wrote a helper library that is highly opinionated to be even more productive and share code between my + + projects:

    docs.rs/oxi-axum-helpers/lates

    It is not documented yet 😅 I will document it and might even write a blog post about it 😃

  5. @cindox Rocket is stagnating and Axum is going up like a rocket 🚀😉

    My recommendations would be and .

    I don't have experience with frontends (e.g. yew) so far, but if you just want Templates, check out

    My blog posts might be helpful:

    Axum + Askama: mo8it.com/blog/getting-started

    SQLx: mo8it.com/blog/sqlx-interactin

  6. Dec 23
    forgot to update regularly.
    - working on my web app
    - using #axum web framework
    - for templating picked #askama
    - using #TailwindCSS for styling
    - for db using #surrealdb
    - basic structure is done
    - next need to add error handling, tracing
    so far enjoying writing #RustLang