Formatting template files
The HTML in template files is currently rather messy, It would be good if it could be formatted nicely with an automated formatter, similar to cargo fmt. So far i found two possible tools, but neither of them really works for our usecase:
-
Tidy with
tidy -mi -w 100 --drop-empty-elements no templates/viewtopic.html.hbs: only works on complete html files, so when called on partials, it adds head and tries to close all divs, so those changes have to be reverted manually. Even then, the html ends up broken in some unknown way, and the site only returns error 500. - Prettier: has support for both html and handlebars, which is ideal for our usecase. Unfortunately it throws errors and fails to run at all, because partials are not supported (https://github.com/prettier/prettier/issues/11834, https://github.com/glimmerjs/glimmer-vm/issues/1367)
If you used yew.rs, you could move all the template html to rust, as well as get rid of the rocket back-end entirely.
Sounds like it wouldnt work without js in that case, which i want to avoid. I also dont want to translate templates to another language, tried that before and its a ton of work for very little benefit. Right now i can simply copy-paste most of the html and use it directly.
Yew uses an html! macro but ya it would probably still be a lot of work... only worth it if you had very few templates.
Yew also has SSR(renderToString()) and isomorphic app support tho, so if the site doesn't need javascript, its still usable. I'm considering using it for future web apps even tho its slower than inferno and solidjs, just because working in rust is so much nicer.