sailfish icon indicating copy to clipboard operation
sailfish copied to clipboard

Render from String as opposed from defining a template struct pointing to a file?

Open fcoury opened this issue 2 years ago • 2 comments
trafficstars

Is is possible to render directly from a String using dynamic attributes?

fcoury avatar Feb 03 '23 22:02 fcoury

Doubt it. This crate is compile time based.

svelterust avatar Feb 06 '23 17:02 svelterust

Although sailfish can't parse runtime template, Rendering based on compile-time string should be possible like this:

#[derive(TemplateOnce)]
#[template = "<div><%= name %></div>"]
struct Template {
    name: String
}

Kogia-sima avatar Mar 05 '23 10:03 Kogia-sima