Hi!
There's a pre-processing step in my project, where the templates are built using Vite. This happens inside a build script. The built templates are being output into the OUT_DIR of my crate.
There doesn't seem to be any way to refer to <OUT_DIR>/my-template.html.
What I already tried:
#[derive(Template)]
#[template(path = concat!(env!("OUT_DIR"), "/my-template.html"))]
struct MyTemplate { /* ... */ }
This doesn't work, as Rust doesn't expand the inner macro before passing it to the derive macro.
I think the cleanest solution would be to have an ability to specify some config options as compile-time environment variables (e.g. ASKAMA_BASE_PATH). I could then set this environment variable inside my build script, provided that Rust passes env vars into the procedural macro crates, which I don't know.
What are your opinions and does anyone have any other suggestion?
Hi!
There's a pre-processing step in my project, where the templates are built using Vite. This happens inside a build script. The built templates are being output into the
OUT_DIRof my crate.There doesn't seem to be any way to refer to
<OUT_DIR>/my-template.html.What I already tried:
This doesn't work, as Rust doesn't expand the inner macro before passing it to the derive macro.
I think the cleanest solution would be to have an ability to specify some config options as compile-time environment variables (e.g.
ASKAMA_BASE_PATH). I could then set this environment variable inside my build script, provided that Rust passes env vars into the procedural macro crates, which I don't know.What are your opinions and does anyone have any other suggestion?